changing local variable values in python debugger
Jeremy Jones
zanesdad at bellsouth.net
Fri Sep 17 09:50:42 EDT 2004
Richie Hindle wrote:
>[Jeremy]
>
>
>>Is there any way to modify a local variable in the Python debugger (pdb)?
>>[...]
>>(Pdb) f
>>'a'
>>(Pdb) f = 'd'
>>(Pdb) f
>>'a'
>>
>>
>
>In fact what you're doing there *is* working - look:
>
>
>
>>c:\src\tests\jeremy-pdb.py(9)main()
>>
>>
>-> if f == 'd':
>(Pdb) f
>'b'
>(Pdb) f = 'd'
>(Pdb) s
>
>
>>c:\src\tests\jeremy-pdb.py(10)main()
>>
>>
>-> b(f)
>
>Setting the value of a local variable works, but *examining* the value resets
>it to whatever it was when you arrived at the current pdb prompt. It's a bug,
>either in pdb or in Python's core debugger support depending on how you look
>at it. I've been meaning to try to fix this for ages, but haven't found the
>time to figure out how to do so.
>
>
>
Doh! Thanks! I didn't try to continue stepping through without
re-evaluating the variable. That will save my sanity. I knew there had
to be a way to do it, but I didn't know that I was already doing it.
Thanks again!
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040917/7a8e9231/attachment.html>
More information about the Python-list
mailing list