[Stackless-checkins] CVS: slpdev/src/2.3/dev/Lib copy_reg.py, 1.1.1.3, 1.2

Christian Tismer tismer at centera.de
Thu Apr 29 04:36:23 CEST 2004


Update of /home/cvs/slpdev/src/2.3/dev/Lib
In directory centera.de:/tmp/cvs-serv17250/dev/Lib

Modified Files:
	copy_reg.py 
Log Message:
supporting stackless pickling for types which don't have __reduce__
when they allow for inheritance. Example: module

Index: copy_reg.py
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Lib/copy_reg.py,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -C2 -d -r1.1.1.3 -r1.2
*** copy_reg.py	8 Jan 2004 22:09:41 -0000	1.1.1.3
--- copy_reg.py	29 Apr 2004 02:36:21 -0000	1.2
***************
*** 68,71 ****
--- 68,78 ----
          if base is self.__class__:
              raise TypeError, "can't pickle %s objects" % base.__name__
+         ## Stackless addition BEGIN
+         # if base is only supported by our shadow types in copy_reg,
+         # we need to substitute here:
+         reducer = dispatch_table.get(base)
+         if reducer:
+             base = reducer(self)[0]
+         ## Stackless addition END
          state = base(self)
      args = (self.__class__, base, state)


_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins



More information about the Stackless-checkins mailing list