[Stackless] Re: [Python-Dev] Stackless pages

Christian Tismer tismer at tismer.com
Mon Nov 6 18:12:01 CET 2000

Just van Rossum wrote:
> Right, how often do we have to repeat that? Continuations aren't even
> needed to do full coroutining and uthreading. But, as Christian has put it
> before, with Stackless you get continuations for free, and they're
> fantastic study material.

Gorson wrote:
> >If we can't overcome "ew - a call might not ever return" there's
> >not much sense in writing the PEPs.
> What I didn't quite understand was that these (new) objections seem to be
> about the C API: Stackless doesn't play _any_ C tricks, so I was under the
> impression all C calls are garuanteed to return, no? On the Python level:
> who cares, that's what continuations are for...

Shure, the C calls do return.
What Gordon means is (I think): If a C function calls a Python
function, it assumes that the Python function has run. With
Stackless, this is no longer true. This is indicated by not
returning the function result, but the Py_UnwindToken, indicating
that the call to the Python function has been deferred.
However this may be implemented in the future, the principle
must stay: We need tail-recursive calls. That means to delay
the execution of a Python function, return from the calling C
function, then execute the Python function via the scheduler,
and then re-entering the C function.

So this is basic the C stack unwinding, which we *must* do.
It is the basic principle which allows non-stack-ordered

This is in fact the real problem. There is no way to avoid this,
if you want more than simple generators.

Continuations are a bit peculiar in their implementation, but
this is my personal problem. The real problem is Stackless.

ciao - chris

Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com
Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list