[New-bugs-announce] [issue14531] Backtrace should not attempt to open <stdin> file

Edward Yang report at bugs.python.org
Sun Apr 8 21:01:23 CEST 2012


New submission from Edward Yang <ezyang at mit.edu>:

When generating a backtrace from an interactive Python session (e.g. the input is from <stdin>, Python attempts to actually find a file named <stdin>, to somewhat hilarious consequences.

See the strace'd Python session below:

>>> foo
open("/etc/default/apport", O_RDONLY|O_LARGEFILE) = 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
open("<stdin>", O_RDONLY|O_LARGEFILE)   = -1 ENOENT (No such file or directory)
open("<stdin>", O_RDONLY|O_LARGEFILE)   = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/pylint-0.24.0-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/logilab_astng-0.22.0-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/logilab_common-0.56.1-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/unittest2-0.5.1-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/gitdb-0.5.4-py2.7-linux-i686.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/smmap-0.8.1-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/async-0.6.1-py2.7-linux-i686.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/decorator-3.3.1-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.2-py2.7-linux-i686.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/docutils-0.8.1-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/Jinja2-2.6-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/Pygments-1.4-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/nose-1.1.2-py2.7.egg/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Dev/6.02/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Dev/pyafs/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Dev/wizard/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Dev/twisted/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.6/site-packages/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Work/shared-python/build/lib.linux-i686-2.6/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Work/snarfs/python/coil/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/ezyang/Dev/py-github/src/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/plat-linux2/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-tk/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-old/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-dynload/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/python2.7/dist-packages/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/Numeric/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/PIL/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/gst-0.10/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/gtk-2.0/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/pymodules/python2.7/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/pymodules/python2.7/libubuntuone/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/ubuntu-sso-client/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/ubuntuone-client/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/ubuntuone-couch/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/ubuntuone-installer/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/<stdin>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
NameError: name 'foo' is not defined
>>>

----------
components: Library (Lib)
messages: 157805
nosy: ezyang
priority: normal
severity: normal
status: open
title: Backtrace should not attempt to open <stdin> file
versions: Python 2.7, Python 3.4

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


More information about the New-bugs-announce mailing list