summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-03-03 22:20:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-03-03 22:20:56 (GMT)
commit14b89ffc7e7cf3fb7e65bf6350de2c53554515ea (patch)
treed9b58f7ba125eef18952dee81396b08b1ddf2f2f /Lib
parent9a572ba9663cce56aa4cc385502acfa5521b5f26 (diff)
downloadcpython-14b89ffc7e7cf3fb7e65bf6350de2c53554515ea.zip
cpython-14b89ffc7e7cf3fb7e65bf6350de2c53554515ea.tar.gz
cpython-14b89ffc7e7cf3fb7e65bf6350de2c53554515ea.tar.bz2
Fix-up __reduce__ which could not reach the __keys variable indirectly.'
Diffstat (limited to 'Lib')
-rw-r--r--Lib/collections.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index 4028983..a1e8ed9 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -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