[Python-3000] Bug with pdb.set_trace() and with block
Christian Heimes
lists at cheimes.de
Thu Oct 11 17:32:25 CEST 2007
I found a pretty annoying bug caused by with blocks. A with block
terminates the debugging session and the program keeps running. It's not
possible to go to the next line with 'n'. 's' steps into the open() call.
# pdbtest.py
import pdb
pdb.set_trace()
print("before with")
with open("/etc/passwd") as fd:
data = fd.read()
print("after with")
print("end of program")
$ ./python pdbtest.py
> /home/heimes/dev/python/py3k/pdbtest.py(3)<module>()
-> print("before with")
(Pdb) n
before with
> /home/heimes/dev/python/py3k/pdbtest.py(4)<module>()
-> with open("/etc/passwd") as fd:
(Pdb) n
after with
end of program
Christian
More information about the Python-3000
mailing list