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.
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
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
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
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
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: