Commit 14b89ffc authored by Raymond Hettinger's avatar Raymond Hettinger

Fix-up __reduce__ which could not reach the __keys variable indirectly.'

parent 9a572ba9
......@@ -58,9 +58,13 @@ class OrderedDict(dict, MutableMapping):
def __reduce__(self):
items = [[k, self[k]] for k in self]
tmp = self.__keys
del self.__keys
inst_dict = vars(self).copy()
inst_dict.pop('__keys', None)
return (self.__class__, (items,), inst_dict)
self.__keys = tmp
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)
setdefault = MutableMapping.setdefault
update = MutableMapping.update
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment