[New-bugs-announce] [issue1265] pdb bug with "with" statement

Christian Heimes report at bugs.python.org
Thu Oct 11 18:00:52 CEST 2007

New submission from Christian Heimes:

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
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

components: Interpreter Core, Library (Lib)
messages: 56346
nosy: tiran
severity: normal
status: open
title: pdb bug with "with" statement
versions: Python 3.0

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list