[Stackless] how to check for C stack?
Christian Tismer
tismer at stackless.com
Mon Feb 23 14:19:06 CET 2004
Giovanni Bajo wrote:
> Hello,
>
> before, there was a tasklet.frame.cstack. How do I check for it now? I'm trying
> to emit a sensible error message when pickling a tasklet which can't possibly
> be continued after unpickling.
The tasklet.frame.cstack object has vanished, resp. it was
moved into tasklet.cstate. But this doesn't help, since
all tasklets have a cstate now, which might be trivial
or not. This is handled internally.
The crucial criterion for being able to revive a pickled
tasklet is whether it has a zero nesting_level, which counts
the number of "interpreters" or other calls into C below the
top-level. The criterion is that nesting_level has to be zero.
Although the nesting level is stored inside the cstate
structure, it is available though the tasklet object.
So, testing for "t.nesting_level == 0" gives you a safe criterion
whether the unpickle will be runnable.
I agree this should better be available via an extra property.
If you can give me a reasonable name for that property, I'm
happy to add it.
Maybe "clonable"? Bad, since we can clone but not run. Hmm.
"runnable"? Bad.
thanks for input -- ciao - chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list