[Python-Dev] Bug? Can't rebind local variables after calling pdb.set_trace()

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Apr 12 18:17:37 CEST 2011


On Tue, Apr 12, 2011 at 11:15 AM, Djoume Salvetti <dsalvetti at trapeze.com> wrote:
..
> When calling pdb.set_trace() from within a function, it seems to be impossible to rebind any local variables:
>

Works for me (using latest HG clone):

$ cat test.py
gv = 1

def f():
    lv = 1
    import pdb; pdb.set_trace()

if __name__ == '__main__':
    f()
$ ./python.exe test.py
--Return--
> /Users/sasha/Work/python-hg/py3k/test.py(5)f()->None
-> import pdb; pdb.set_trace()
(Pdb) lv = 2
(Pdb) print lv
2


> http://paste.pound-python.org/show/5150/

Please don't use paste services when posting on python-dev.  Postings
to this list are archived much longer than links to paste services
remain valid.

>
> I couldn't find anything in the documentation about this, should I report a bug?

If you find specific versions that are affected by this bug, please
report it at bugs.python.org.


More information about the Python-Dev mailing list