Re: [Python-Dev] frame.f_locals is writable

2005-01-14 Thread Nick Coghlan
Shane Holloway (IEEE) wrote: Yes. After poking around in Google with PyFrame_LocalsToFast, I found some other links to people doing that. I implemented a direct call using ctypes to make the code explicit about what's happening. I'm just glad it is possible now. Works fine in both 2.3 and 2.

Re: [Python-Dev] frame.f_locals is writable

2005-01-14 Thread Shane Holloway (IEEE)
FWIW, this should work: def replaceFrame(self, ref, oldValue, newValue): for name, value in ref.f_locals.items(): if value is oldValue: exec "ref.f_locals[name] = newValue" assert ref.f_locals[name] is newValue And, no, you don't have to tell

Re: [Python-Dev] frame.f_locals is writable

2005-01-14 Thread Shane Holloway (IEEE)
Brett C. wrote: Other option would be to add a function that either directly modified single values in f_localsplus, a function that takes a dict and propogates the values, or a function that just calls PyFrame_LocalsToFast() . Brett!! Thanks for looking this up! With a little help from ctypes

Re: [Python-Dev] frame.f_locals is writable

2005-01-14 Thread Nick Coghlan
Shane Holloway (IEEE) wrote: For a little background, I'm working on making an edit and continue support in python a little more robust. So, in replacing references to unmodifiable types like tuples and bound-methods (instance or class), I iterate over gc.get_referrers. So, I'm working on fram

Re: [Python-Dev] frame.f_locals is writable

2005-01-13 Thread Brett C.
Shane Holloway (IEEE) wrote: For a little background, I'm working on making an edit and continue support in python a little more robust. So, in replacing references to unmodifiable types like tuples and bound-methods (instance or class), I iterate over gc.get_referrers. So, I'm working on fram

[Python-Dev] frame.f_locals is writable

2005-01-13 Thread Shane Holloway (IEEE)
For a little background, I'm working on making an edit and continue support in python a little more robust. So, in replacing references to unmodifiable types like tuples and bound-methods (instance or class), I iterate over gc.get_referrers. So, I'm working on frame types, and wrote this code: