Jim Jewett wrote:
The only members that need special attention are (f_code, f_lasti) and possibly (f_blockstack, f_iblock).
You don't even need to take care of f_code. The thunk and its surrounding function can share the same code. The thunk gets compiled into the function the same way the body of a for loop would.
(f_code, f_lasti) would need to be replaced with a stack of pairs. Finishing a code string would mean popping this stack, rather than popping the whole frame.
There doesn't need to be a stack; each thunk can store its own f_lasti.
One also needs to store f_back, and, to avoid exception weirdness, f_exc_XXX.
In this way, calling the thunk is much like resuming a generator.
-Brian _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com