[Python-3000] Bug with pdb.set_trace() and with block

Guido van Rossum guido at python.org
Thu Oct 11 18:55:34 CEST 2007


Please file this in the bug tracker.

Thanks for finding this -- I kew there was a problem with the debugger
losing control but I never traced it down to the with statement!

On 10/11/07, Christian Heimes <lists at cheimes.de> wrote:
> 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
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list