summaryrefslogtreecommitdiffstats
path: root/Lib/collections/__init__.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-04-19 18:04:44 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-04-19 18:04:44 (GMT)
commit98c850a398569de67c2428acd0396bbdc4c2b02f (patch)
tree5539b4caa8f4bff2c69d3300a8a7c7c43b140d08 /Lib/collections/__init__.py
parent64e564b8f5de1f1822f051f98d3b247bdd001f74 (diff)
parent35b873a7b2b25bf90099b1d449a35d6ff695d02b (diff)
downloadcpython-98c850a398569de67c2428acd0396bbdc4c2b02f.zip
cpython-98c850a398569de67c2428acd0396bbdc4c2b02f.tar.gz
cpython-98c850a398569de67c2428acd0396bbdc4c2b02f.tar.bz2
Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object.
Diffstat (limited to 'Lib/collections/__init__.py')
-rw-r--r--Lib/collections/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index a6bcaea..32c2e80 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -155,10 +155,9 @@ class OrderedDict(dict):
def __reduce__(self):
'Return state information for pickling'
items = [[k, self[k]] for k in self]
- tmp = self.__map, self.__root, self.__hardroot
- del self.__map, self.__root, self.__hardroot
inst_dict = vars(self).copy()
- self.__map, self.__root, self.__hardroot = tmp
+ for k in vars(self.__class__()):
+ inst_dict.pop(k, None)
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)