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

Lennart Regebro regebro at gmail.com
Tue Apr 12 22:05:57 CEST 2011


Hasn't it always been like that? I tried with Python 2.3 now and it's
the same. I have no memory of that actually changing an existing
variable in any version of Python I've used. More testing turns out
that this works:

-> print "lv is ", lv
(Pdb) lv=2
(Pdb) c
lv is  2

While this seem to "reset" is:

-> print "lv is ", lv
(Pdb) lv=2
(Pdb) lv
1
(Pdb) c
lv is  1

This is the same from Python 2.3 to 2.6. I thought is just was a lack
of feature, that there for some reason was really hard to change the
value of an existing variable from the debugger. I though that for ten
years. It never occurred to me to change the variable and type c
without first checking that the variable had changed... :-)

It is however fixed in 2.7.

-> print "lv is ", lv
(Pdb) lv=2
(Pdb) lv
2
(Pdb) c
lv is  2


But this bug/lack of feature has been there as long as I can remember. :-)

//Lennart


More information about the Python-Dev mailing list