diff options
author | Raymond Hettinger <python@rcn.com> | 2011-04-19 09:48:39 -0700 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-04-19 09:48:39 -0700 |
commit | 9940ba3a44d7a767922efdfe7040879b8f2a0104 (patch) | |
tree | e9bf0a62a5891a384c12c57c4a0e6abb4c944897 /Lib | |
parent | 691e389f96517b12466a430f3353c42e39f02b27 (diff) | |
download | cpython-9940ba3a44d7a767922efdfe7040879b8f2a0104.tar.gz |
Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/collections.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index 3c54690eb5..28a2abf44f 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -115,10 +115,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 - del self.__map, self.__root inst_dict = vars(self).copy() - self.__map, self.__root = tmp + for k in vars(OrderedDict()): + inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return self.__class__, (items,) |