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 <[email protected]>wrote: > On Sun, May 20, 2012 at 10:29 AM, Sylvain Prat <[email protected]> > 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 > [email protected] > http://www.stackless.com/mailman/listinfo/stackless >
_______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless
