[Stackless] Fwd: deepcopying (pickling) channels

John Ehresman jpe at wingware.com
Tue Oct 29 16:54:38 CET 2013


On 10/27/13 6:18 PM, Christian Tismer wrote:
> So my guess of the solution is this:
>
> Let wingdb_import_hook report "__builtin__" as its module and
> '__import__' as
> its name, and you are fine.

You're right.  The problem with simply using a name other than 
__builtin__.__import__ is that it may not be there when a pickle is 
loaded because the debugger may not be running.  This is illustrated by 
the attached failimp.py file.  Try running:
	failimp.py debug dump
	failimp.py load
This simulates creating a pickle when the debugger is running and then 
trying to load it when the debugger is not running.  The workaround is 
to set __module__ to '__builtin__' and __name__ to '__import__' on the 
import_hook function.

Thanks,

John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: failimp.py
Type: text/x-python-script
Size: 603 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20131029/e0ee95f2/attachment.bin>


More information about the Stackless mailing list