Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-07 Thread Phillip J. Eby
At 12:06 PM 2/8/2007 +1300, Greg Ewing wrote: >That's because the topmost frame has a module's dict >as its locals, so in that case you are modifying them >directly. It's only code compiled as the body of a >function that uses an array for locals. By "topmost", he means the frame that was interrup

Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-07 Thread Greg Ewing
Fabio Zadrozny wrote: > Would it be ok to add a feature request for that? It seems a reasonable thing to suggest. Instead of a copy, locals() could return a mapping object that is a view of the underlying array. The only limitation then would be that you couldn't add new keys. > I initially thou

Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-07 Thread Phillip J. Eby
At 08:11 AM 2/7/2007 -0200, Fabio Zadrozny wrote: >Would it be ok to add a feature request for that? I initially thought it >was completely read-only, but I find it strange that it affects the >topmost frame correctly (so, it seems that even though I get a copy, when >I alter that copy on the to

Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-07 Thread Fabio Zadrozny
On 2/7/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: Seriously, a feature request is likely to sit there forever. If you would come up with an actual patch, that would be a different thing. You'll likely answer your other question in the process of developing a patch, too. Ok... I've adde

Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-07 Thread Martin v. Löwis
Fabio Zadrozny schrieb: > Would it be ok to add a feature request for that? Nobody can stop you, anyway :-) Seriously, a feature request is likely to sit there forever. If you would come up with an actual patch, that would be a different thing. You'll likely answer your other question in the pro

Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-07 Thread Fabio Zadrozny
On 2/7/07, Greg Ewing <[EMAIL PROTECTED]> wrote: Fabio Zadrozny wrote: > frame = findFrame(thread_id, frame_id) > exec '%s=%s' % (attr, expression) in frame.f_globals, frame.f_locals The locals of a function are actually stored in an array. When you access them as a dict using locals(), all yo

Re: [Python-Dev] Changing a value in a frame (for a debugger)

2007-02-06 Thread Greg Ewing
Fabio Zadrozny wrote: > frame = findFrame(thread_id, frame_id) > exec '%s=%s' % (attr, expression) in frame.f_globals, frame.f_locals The locals of a function are actually stored in an array. When you access them as a dict using locals(), all you get is a dict containing a copy of their current v

[Python-Dev] Changing a value in a frame (for a debugger)

2007-02-06 Thread Fabio Zadrozny
Hi All, I'm currently trying to change the value for a variable in the debugger using: frame = findFrame(thread_id, frame_id) exec '%s=%s' % (attr, expression) in frame.f_globals, frame.f_locals it works well when the frame for the change is the topmost frame, but fails otherwise... I found so