[Stackless] Retrieving the Return Value of a Stackless Python Tasklet Bound Function?

Richard Tew richard.m.tew at gmail.com
Tue Jun 22 23:16:59 CEST 2010


On Tue, Jun 22, 2010 at 11:37 PM, Lin Luo <luolin at ccpgames.com> wrote:
> the caller. But I have yet to see a way to retrieve the return value of the
> bound callable running as a tasklet.

I do not know that there is one.

> important return value to be used later. It seems that writing such a
> Micromanaging function on the C side is not very feasible, since I haven't

The simplest way to do this would be to define the wrapping Python
function code in C as a string, and to compile it into a function
object that you can run as a tasklet.  An example Python function
follows, the C part I leave to you.

e.g.

  def RunFunctionAndGetResult(chan, func, *args, **kwargs):
      chan.send(func(*args, **kwargs))

Cheers,
Richard.



More information about the Stackless mailing list