summaryrefslogtreecommitdiff
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-04-19 10:05:03 -0700
committerRaymond Hettinger <python@rcn.com>2011-04-19 10:05:03 -0700
commitd08a2c2576457b7d0229a00b4977044a38ad0d68 (patch)
tree2b9cd896eecc872a675abee46ef4158fedf39a72 /Lib/collections.py
parent2876a8c272ec9fd7ddd9fec62676bc61ba947747 (diff)
downloadcpython-git-d08a2c2576457b7d0229a00b4977044a38ad0d68.tar.gz
Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index fb9464fa87..9381f51676 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -101,10 +101,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.__in_repr
- del self.__map, self.__root, self.__in_repr
inst_dict = vars(self).copy()
- self.__map, self.__root, self.__in_repr = 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,)