This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ericp
Recipients ericp, r.david.murray
Date 2010-07-16.18:56:56
SpamBayes Score 0.11328517
Marked as misclassified No
Message-id <1279306620.09.0.566662656474.issue9274@psf.upfronthosting.co.za>
In-reply-to
Content
I've modified the bug status so anyone can read it.  You
don't need an account to read ActiveState bugs, only to
add or comment on one.

Please note that I closed bug http://bugs.activestate.com/show_bug.cgi?id=87405, as we're now writing
to frame->f_localsplus[] to make sure changes to locals
stick.  I logged a different bug on Komodo's dependence
on this bug at

http://bugs.activestate.com/show_bug.cgi?id=87417

-------------------------------------------------
Here's how we run into this bug:

In Komodo, while you're debugging, you can push an
interactive shell, that uses the current state of the
program.  We build each block of code the user
types in a variable called source, and try executing
it like so: 

code.InteractiveInterpreter(locals()).runsource(source, "<console>")

In other words, we're letting the Python core do all the
heavy lifting identifying multi-line stmts, indented blocks,
etc.

We've had problems with modifying local variables in the
Python debugger for years (almost a decade now).  I got
a C extension working using frame->f_localsplus to
make sure modifications are persisted, but noticed that
changes in the interactive shell weren't being persisted.

I distilled the code we use into the attached file, which
shows that changes aren't being persisted here.  I'm
not an expert on core internals, but I suspect that 
python code "locals()" maps to C code "frame->f_locals",
and we still have the problem that inside functions,
frame->f_locals is a temporary object that is rebuilt on
each access.  From what I've observed, frame->f_localsplus
points to the actual items, and these are the
pointers that need to be changed.
History
Date User Action Args
2010-07-16 18:57:00ericpsetrecipients: + ericp, r.david.murray
2010-07-16 18:57:00ericpsetmessageid: <1279306620.09.0.566662656474.issue9274@psf.upfronthosting.co.za>
2010-07-16 18:56:58ericplinkissue9274 messages
2010-07-16 18:56:57ericpcreate