
rushing@nightmare.com wrote: [...]
BTW, I have actually made progress borrowing a bit of code from SCM. It uses the stack-copying technique, along with setjmp/longjmp. It's too ugly and unportable to be a real candidate for inclusion in Official Python. [i.e., if it could be made to work it should be considered a stopgap measure for the desperate].
I tried it and built it as a Win32 .pyd file, and it seems to work, but...
I haven't tested it thoroughly, but I have successfully saved and invoked (and reinvoked) a continuation. Caveat: I have to turn off Py_DECREF in order to keep it from crashing.
Indeed, and this seems to be a problem too hard to solve without lots of work. Since you keep a snapshot of the current machine stack, it contains a number of object references which have been valid when the snapshot was taken, but many are most probably invalid when you restart the continuation. I guess, incref-ing all current alive objects on the interpreter stack would be the minimum, maybe more. A tuple of necessary references could be used as an attribute of a Continuation object. I will look how difficult this is. ciao - chris -- Christian Tismer :^) <mailto:tismer@appliedbiometrics.com> Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net 10553 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF we're tired of banana software - shipped green, ripens at home