summaryrefslogtreecommitdiff
path: root/Lib/copy.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-06 17:41:20 +0000
committerGuido van Rossum <guido@python.org>2002-06-06 17:41:20 +0000
commit802898ed9bd4d2eabd43ec918c5d217ed9aea2bc (patch)
treec6ac3255b24293963e4b2d43f83002dfb0220abc /Lib/copy.py
parentff01db6b6fbd26afd4116fdbd1169520b6f7de8e (diff)
downloadcpython-802898ed9bd4d2eabd43ec918c5d217ed9aea2bc.tar.gz
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__).
Diffstat (limited to 'Lib/copy.py')
-rw-r--r--Lib/copy.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 01805549ab..77b7ad3a00 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