summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-06 17:41:20 (GMT)
committerGuido van Rossum <guido@python.org>2002-06-06 17:41:20 (GMT)
commit3e3583c345e35d72a394f751bbee33257880fbd4 (patch)
tree5e5bd8efdd10176c02679934c54fed96037799bc
parent88a20baa77493d2a432f1636d2933001f083f0e8 (diff)
downloadcpython-3e3583c345e35d72a394f751bbee33257880fbd4.zip
cpython-3e3583c345e35d72a394f751bbee33257880fbd4.tar.gz
cpython-3e3583c345e35d72a394f751bbee33257880fbd4.tar.bz2
Fix from SF patch 565085: copy._reduction doesn't __setstate__.
Straightforward fix. Will backport to 2.2. If there's ever a new 2.1 release, this could be backported there too (since it's an issue with anything that's got both a __reduce__ and a __setstate__).
-rw-r--r--Lib/copy.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 0180554..77b7ad3 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -301,7 +301,10 @@ def _reconstruct(x, info, deep, memo=None):
if state:
if deep:
state = deepcopy(state, memo)
- y.__dict__.update(state)
+ if hasattr(y, '__setstate__'):
+ y.__setstate__(state)
+ else:
+ y.__dict__.update(state)
return y
del d