[Stackless] pickling modules & stackless

Christian Tismer tismer at stackless.com
Thu Jan 9 12:11:20 CET 2014


On 09.01.14 11:31, Anselm Kruis wrote:
> Hi Lars,
>
> ...
> You wrote "the loaded model seems to use a pre-change class 
> definition". Probably you observe the following: if you pickle a 
> tasklet, the tasklet contains the list of frames on the stack. Each 
> frame represents a running function, but the frame does not reference 
> the function object but the code object of the function. Now code 
> objects are always pickled by value. Upon unpickling you get the old 
> code objects. With other words, you can't magically modify the code, 
> that currently executes. Pickling code objects by value is required, 
> because local variables, cells, code and the instruction pointer must 
> be in an consistent state.

Well, Lars also asked

"""
So my questions are, is this caused by stackless (compared to vanilla
python) and if so, what triggers the pickling of modules and how can i
influence that or use the vanilla version of pickle instead.
"""

Because he considered to use the vanilla python pickling, I assumed
that no tasklets are involved.
That is a very special and known stackless feature.

But maybe that is the bug, and there are unwanted references to tasklets
in the model by chance. To avoid this, removing or running all tasklets
to their end before pickling should help.

cheers -- chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     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
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/




More information about the Stackless mailing list