[Stackless] Fwd: deepcopying (pickling) channels

Christian Tismer tismer at stackless.com
Fri Oct 25 02:20:13 CEST 2013


On 25.10.13 00:05, Christian Tismer wrote:
> On 24.10.13 22:38, John Ehresman wrote:
>> On 10/24/13 3:51 PM, John Ehresman wrote:
>>> On 10/24/13 3:19 PM, lars van Gemerden wrote:
>>>> Did some digging in the call stack:
>>>> ...
>>>
>>> Where is reduce function for module objects defined?  It's returning a
>>> dict with an __import__ key value defined, even though __import__ is in
>>> builtins rather than the module dict.  What I'd like the reduce 
>>> function
>>> to do is return a dict without __import__.
>>
>> It looks like this is defined in Stackless/pickling/prickelpit.c and 
>> it looks like it explicitly gets the __import__ value and returns 
>> it.  Is there a reason for this?  I'm interested in make pickle work 
>> such that something can be pickled when the debugger is active and 
>> then later unpickled when it's not active.
>
> Yes, I was about to reply "prickelpit" as well.
> Don't remember yet why (probably) I have done it this way, 10 years ago.
>
> I have no problem to make that better usable with Wing.
> But maybe it needs to bump the version because people
> have saved, quite old versions.
>
> Having that said, I will look a bit deeper now.

I looked into the old CVS sources. The code is different, but has the same
principle:

> /* Get the __import__ function from the builtins */ if 
> (PyDict_Check(builtins)) { import = PyObject_GetItem(builtins, 
> import_str); if (import == NULL) PyErr_SetObject(PyExc_KeyError, 
> import_str); } else import = PyObject_GetAttr(builtins, import_str); 
> if (import == NULL) goto err; tup = Py_BuildValue("(O(s))", import, 
> name); 

Richard's version uses a slightly different way, but also grabs __import__
from the builtins of the interpreter.

There is no other reason for this, it was just simple and nobody complained.
And the problem is that I am giving that function back, which is your hook, right?

WingIDE does not have its own extension module and therefore cannot
circumvent this, easily. Otherwise it would simply put its own builtin
there, am I correct?

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