[Stackless] Tasklet cleanup?

Hervé Coatanhay herve.coatanhay at gmail.com
Thu Jul 5 20:42:02 CEST 2012

Hi all,

I was playing with stackless.py from pypy. In that implementation kill()
definitely raises an exception:


Just so you know.

On Fri, May 25, 2012 at 5:11 AM, Richard Tew <richard.m.tew at gmail.com>wrote:

> On Sun, May 20, 2012 at 10:29 AM, Sylvain Prat <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
> http://www.stackless.com/mailman/listinfo/stackless
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120705/dca5c386/attachment-0001.html>

More information about the Stackless mailing list