diff options
author | Guido van Rossum <guido@python.org> | 2001-09-25 19:46:05 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-25 19:46:05 (GMT) |
commit | 698acf98fdafd14b1b5ad380e3c56b31ab33a229 (patch) | |
tree | ec96096f9319d237bbe3c90bf895c278cba84431 /Lib/copy_reg.py | |
parent | d48004f4f038799d3e82a580e29f8ad1dae50a5e (diff) | |
download | cpython-698acf98fdafd14b1b5ad380e3c56b31ab33a229.zip cpython-698acf98fdafd14b1b5ad380e3c56b31ab33a229.tar.gz cpython-698acf98fdafd14b1b5ad380e3c56b31ab33a229.tar.bz2 |
_reconstructor(): there's no need for tricks with assignment to
__class__. The __new__ protocol is up to this. (Thanks to Tim for
pointing this out.)
Diffstat (limited to 'Lib/copy_reg.py')
-rw-r--r-- | Lib/copy_reg.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index e93c2a3..eb02864 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -36,16 +36,9 @@ pickle(type(1j), pickle_complex, complex) # Support for picking new-style objects -_dummy_classes = {} - def _reconstructor(cls, base, state): - dummy = _dummy_classes.get(base) - if dummy is None: - class dummy(base): pass - _dummy_classes[base] = dummy - obj = dummy(state) - obj._foo = 1; del obj._foo # hack to create __dict__ - obj.__class__ = cls + obj = base.__new__(cls, state) + base.__init__(obj, state) return obj _reconstructor.__safe_for_unpickling__ = 1 |