diff options
| author | Raymond Hettinger <python@rcn.com> | 2011-04-19 10:21:27 -0700 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2011-04-19 10:21:27 -0700 |
| commit | 019a97c77cc750d104adcc53ca4b84e29a069317 (patch) | |
| tree | 09f877d3da00006cd10c71963f0ee5ec5a6b811d /Lib/collections.py | |
| parent | c15d9e759fbbaf54cc97ab41a067ac637c296781 (diff) | |
| download | cpython-git-019a97c77cc750d104adcc53ca4b84e29a069317.tar.gz | |
Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object.
Diffstat (limited to 'Lib/collections.py')
| -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 cde734debd..a1f789082b 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -154,10 +154,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,) |
