[Stackless] Tasklet cleanup?

Christian Tismer tismer at stackless.com
Thu Jul 5 23:18:34 CEST 2012


Just as a note:

the PyPy stackless module was not really maintained in years, and I
remember I had a more compliant version prepared, but lost interest
after the Jit became unsuitable for the stackless version.

Now it's time to finalize and correct this, because a Jit-enabled
stackless is in reach, again.

Will try to get to it, soon.

cheers - Chris

On 7/5/12 8:42 PM, Hervé Coatanhay wrote:
> Hi all,
>
> I was playing with stackless.py from pypy. In that implementation 
> kill() definitely raises an exception:
>
> https://bitbucket.org/pypy/pypy/src/68e7e825d598/lib_pypy/stackless.py#cl-68
>
> Just so you know.
>
> Hervé
> On Fri, May 25, 2012 at 5:11 AM, Richard Tew <richard.m.tew at gmail.com 
> <mailto:richard.m.tew at gmail.com>> wrote:
>
>     On Sun, May 20, 2012 at 10:29 AM, Sylvain Prat
>     <sylvain.prat at gmail.com <mailto:sylvain.prat at gmail.com>> wrote:
>     > I tried to wrap my tasklet in a parent object which has the same
>     > lifespan as my tasklet and has a __del__ function for cleaning
>     up, but
>     > I keep having problems with circular references (the wrapper/parent
>     > object also provides the callable of the tasklet, i.e. a bound
>     method)
>     > that make the tasklet/parent object uncollectable (circular
>     references
>     > : wrapper --> tasklet --> stackless machinery? --> callable stack
>     > frame (bound method of wrapper) --> wrapper). Same problem when
>     trying
>     > to inherit from tasklet.
>     >
>     > So, how can I clean up resources in tasklets? (I'm pretty sure I've
>     > missed something obvious)
>
>     Hi Sylvain,
>
>     Kristjan having clarified that TaskletExit is definitely off the table
>     for now, I'd like to make the response I should have when you first
>     posted.  Fix your circular references and __del__ should be fine.
>
>     What I tend to do is use weak references, where applicable, in order
>     to ensure that nothing keeps a tasklet alive except where I explicitly
>     want.  There is nothing internal to Stackless which will keep a
>     tasklet alive without your implicit direction.  If my tasklets are
>     kept alive and I detect it, then I use gc.get_referrers(tasklet) to
>     track down why.
>
>     Cheers,
>     Richard.
>
>     _______________________________________________
>     Stackless mailing list
>     Stackless at stackless.com <mailto:Stackless at stackless.com>
>     http://www.stackless.com/mailman/listinfo/stackless
>
>
>
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless


-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
work +49 173 24 18 776  mobile +49 173 24 18 776  fax n.a.
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120705/b90b3d9c/attachment.html>


More information about the Stackless mailing list