[issue14531] Backtrace should not attempt to open <stdin> file

STINNER Victor report at bugs.python.org
Mon Apr 9 01:48:49 CEST 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

The filename is retrieved from: traceback->frame->f_code->co_filename. co_filename is an arbitrary string. Example:

>>> exec(compile("1+a", "/etc/passwd", "exec"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/etc/passwd", line 1, in <module>
    root:x:0:0:root:/root:/bin/bash
NameError: name 'a' is not defined

"root:x:0:0:root:/root:/bin/bash" is the first line of the /etc/passwd file.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14531>
_______________________________________


More information about the Python-bugs-list mailing list