[Stackless] Cell pickling bug

Alain Poirier alain.poirier at net-ng.com
Mon Nov 19 15:55:23 CET 2007

Le Saturday 17 November 2007 03:34:47 Christian Tismer, vous avez écrit :
> Richard Tew wrote:
> > On Nov 10, 2007 2:24 PM, Christian Tismer <tismer at stackless.com> wrote:
> >> There is something else wrong with pickling of cells.
> >> I will try to dig this up before a release.
> >> This bugged me on EuroPython, but I forgot it.
> >
> > There is a cell which has a reference to the "sub" function and the
> > "sub" function has a reference to the cell in its closures.  The cell
> > gets created before the function, but does not get built (have
> > __setstate__ called on it) until after the function does.  And the
> > function won't recognise the cell until Stackless has fixed its type
> > when it is built.
> >
> > I removed the call to PyCell_Check in funcobject.c:func_new() in order
> > to see whether that would be enough, but this just results in an
> > uncaught pickling error later on.
> >
> > I don't see an easy fix :-(
> There must be one since it worked, once.
> Will look into this after closing a number
> of other tasks...
> ciao -- chris

I did a little debug session this WE and came to the same conclusions than
Richard : the `__setstate__` function is not called on the `_wrap.cell` 
because of the circular references and I don't see an easy fix too.

I hope you could find a solution.

P.S : to my tests I use this simpler version :

import stackless, pickle

ch = stackless.channel()

def recurs():
    def sub():
        if 0:

if __name__ == '__main__':
    t = stackless.tasklet(recurs)()


More information about the Stackless mailing list