[Stackless] Fwd: deepcopying (pickling) channels

Christian Tismer tismer at stackless.com
Sat Nov 2 01:25:43 CET 2013

On 01.11.13 23:57, Christian Tismer wrote:

Ok, this one is probably better.
It is also independant from the python version.

It will also give you a hint when it becomes obsolete at some later time ;-)

# universal pickling wrapper for WingIDE

import os

def wing_hack(logger):
     when wing has replaced __import__, wrap that with a function
     that pretends to be the original __import__
     import sys
     if sys.version_info[0] >= 3:
         import builtins
         import __builtin__ as builtins
     imp = builtins.__import__
     if imp.__name__ != '__import__':
         logger.info("fixing Wing's import hook")
         def __import__(*args, **kw):
             return imp(*args, **kw)
         __import__.__module__ = builtins.__name__
         builtins.__import__ = __import__
         logger.warn("you can trash the Wing hack")

if 'WINGDB_PYTHON' in os.environ:
     import logging


if __name__ == '__main__':

     import unittest
     import pickle
     import sys

     @unittest.skipIf('Stackless' not in sys.version, 'Stackless only')
     class Test(unittest.TestCase):

         def testAPickle(self):
             def test():

             string = pickle.dumps(test)


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