[Stackless] Fwd: deepcopying (pickling) channels

John Ehresman jpe at wingware.com
Fri Oct 25 16:55:55 CEST 2013


On 10/24/13 8:20 PM, Christian Tismer wrote:
> 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.

It worries me a bit that this is only done for __import__ and not for 
the other builtins; it suggests to me that there is a reason for 
grabbing __import__

> And the problem is that I am giving that function back, which is your
> hook, right?

The immediate issue is that pickle is failing to save globals because of 
the value of __import__.  That is probably fixable, but I'm trying to 
figure out when the saved globals is used -- what happens when a pickle 
created when the debugger is running is unpickled when the debugger 
isn't running?  What happens in the reverse case?

Thanks,

John



More information about the Stackless mailing list