Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object.
diff --git a/Lib/collections.py b/Lib/collections.py
index 3c54690..28a2abf 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -115,10 +115,9 @@
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,)