[Stackless] pickling code objects
Kristján Valur Jónsson
kristjan at ccpgames.com
Fri May 25 12:30:14 CEST 2007
Aha, well, yes pickle works, but reduce ex doesn´t:
(<function __newobj__ at 0x00C8F7C8>, (<type 'code'>,), None, None, None)
so far so good, but you can't continue and pickle the "code" type:
will return an error, because "code" isn´t found in __builtin__ where
it claims to exist. And anyway, the "code" constructor takes some
12 arguments, obviously missing.
We use the __reduce_ex__() protocol to implement our own pickling.
I don't know how pickle(dumps) manages this without invoking __reduce_ex__()
In stackles 2.3 __reduce_ex__(2) would return proper stuff, including the
stackless.code type which was found in module stackless, and proper
The current behavious is consistent with vanilla python, though.
> -----Original Message-----
> From: stackless-bounces at stackless.com [mailto:stackless-
> bounces at stackless.com] On Behalf Of Richard Tew
> Sent: Thursday, May 24, 2007 18:59
> To: Kristján Valur Jónsson
> Cc: stackless at stackless.com
> Subject: Re: [Stackless] pickling code objects
> On 5/24/07, Kristján Valur Jónsson <kristjan at ccpgames.com> wrote:
> > After upgrading eve to stackless 2.5.1 (or rather, as a part of this
> > integration) I discovered that code objects are not pickleable.
> Python 2.5.1 Stackless 3.1b3 060516 (release25-maint:55039:55048, May
> 1 2007, 14:13:4) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> def f():
> ... print 1
> >>> import pickle
> >>> pickle.dumps(f.func_code)
> Is there a reproducibility case for the problem you are experiencing?
> Stackless mailing list
> Stackless at stackless.com
Stackless mailing list
Stackless at stackless.com
More information about the Stackless