Issue 1326406: pdb breaks programs which import from main (original) (raw)
The following example illustrates the problem:
bagira:~/python/dist/src/Lib> cat tt/xx hello=None import yy print "in xx:yy imported"
bagira:~/python/dist/src/Lib> cat tt/yy.py from main import hello print "in yy: yy imported "
this works by itself:
bagira:~/python/dist/src/Lib> ../python tt/xx in yy: yy imported in xx:yy imported
But breaks under pdb
bagira:~/python/dist/src/Lib> ../python -m pdb tt/xx
/home/ilya/python/dist/src/Lib/tt/xx(1)?() -> hello=None (Pdb) c Traceback (most recent call last): File "/home/ilya/python/dist/src/Lib/pdb.py", line 1057, in main pdb.runscript(mainpyfile) File "/home/ilya/python/dist/src/Lib/pdb.py", line 982, in runscript self.run(statement, globals=globals, locals=locals) File "/home/ilya/python/dist/src/Lib/bdb.py", line 367, in run exec cmd in globals, locals File "", line 1, in ? File "tt/xx", line 2, in ? import yy File "/home/ilya/python/dist/src/Lib/tt/yy.py", line 1, in ? from main import hello ImportError: cannot import name hello Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program /home/ilya/python/dist/src/Lib/tt/yy.py(1)?() -> from main import hello