[Python-Dev] Python advanced debug support (update frame code)

Fabio Zadrozny fabiofz at gmail.com
Mon Jan 13 00:08:10 CET 2014


Hi Python-dev.

I'm playing a bit on the concept on live-coding during a debug session and
one of the most annoying things is that although I can reload the code for
a function (using something close to xreload), it seems it's not possible
to change the code for the current frame (i.e.: I need to get out of the
function call and then back in to a call to the method from that frame to
see the changes).

I gave a look on the frameobject and it seems it would be possible to set
frame.f_code to another code object -- and set the line number to the start
of the new object, which would cover the most common situation, which would
be restarting the current frame -- provided the arguments remain the same
(which is close to what the java debugger in Eclipse does when it drops the
current frame -- on Python, provided I'm not in a try..except block I can
do even better setting the the frame.f_lineno, but without being able to
change the frame f_code it loses a lot of its usefulness).

So, I'd like to ask for feedback from people with more knowledge on whether
it'd be actually feasible to change the frame.f_code and possible
implications on doing that.

Thanks,

Fabio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140112/c5672687/attachment.html>


More information about the Python-Dev mailing list