[Python-checkins] r70139 - python/branches/py3k/Lib/collections.py
raymond.hettinger
python-checkins at python.org
Tue Mar 3 23:20:56 CET 2009
Author: raymond.hettinger
Date: Tue Mar 3 23:20:56 2009
New Revision: 70139
Log:
Fix-up __reduce__ which could not reach the __keys variable indirectly.'
Modified:
python/branches/py3k/Lib/collections.py
Modified: python/branches/py3k/Lib/collections.py
==============================================================================
--- python/branches/py3k/Lib/collections.py (original)
+++ python/branches/py3k/Lib/collections.py Tue Mar 3 23:20:56 2009
@@ -58,9 +58,13 @@
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
More information about the Python-checkins
mailing list