diff options
author | Guido van Rossum <guido@python.org> | 2001-12-27 16:27:28 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-27 16:27:28 (GMT) |
commit | 2a6f5b38acfc0ee59ea265d17b31caaa4de1c266 (patch) | |
tree | 628d5c611323fb62da81713be115abbb271fe948 | |
parent | bb2501f6388544fabca7c2df33d91e8577d74ca5 (diff) | |
download | cpython-2a6f5b38acfc0ee59ea265d17b31caaa4de1c266.zip cpython-2a6f5b38acfc0ee59ea265d17b31caaa4de1c266.tar.gz cpython-2a6f5b38acfc0ee59ea265d17b31caaa4de1c266.tar.bz2 |
_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.
-rw-r--r-- | Lib/copy_reg.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index 92cbd53..8a3550a 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -53,6 +53,8 @@ def _reduce(self): if base is object: 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) try: |