[Python-checkins] CVS: python/dist/src/Lib copy_reg.py,1.9,1.10
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 27 Dec 2001 08:27:30 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv29843
Modified Files:
copy_reg.py
Log Message:
_reduce(): Avoid infinite recursion in the pickler when self.__class__
doesn't have the _HEAPTYPE flag set, e.g. for time.struct_time and
posix.stat_result.
This fixes the immediate symptoms of SF bug #496873 (cPickle /
time.struct_time loop), replacing the infinite loop with an exception.
Index: copy_reg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** copy_reg.py 2001/11/24 21:04:31 1.9
--- copy_reg.py 2001/12/27 16:27:28 1.10
***************
*** 54,57 ****
--- 54,59 ----
state = None
else:
+ if base is self.__class__:
+ raise TypeError, "can't pickle %s objects" % base.__name__
state = base(self)
args = (self.__class__, base, state)