diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2009-06-12 23:03:35 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2009-06-12 23:03:35 (GMT) |
commit | cb73bdac9565e7d4a9133635f802f446a915ca88 (patch) | |
tree | d87c607a7fdbd52c215b4c5a9d7cc640d94b2e36 /Lib/collections.py | |
parent | 450ae573bcf3b8b9e910dacf5dcf640cced44b97 (diff) | |
download | cpython-cb73bdac9565e7d4a9133635f802f446a915ca88.zip cpython-cb73bdac9565e7d4a9133635f802f446a915ca88.tar.gz cpython-cb73bdac9565e7d4a9133635f802f446a915ca88.tar.bz2 |
Revert r73401 per Raymond Hettinger's request.
The rational is the change might cause imcompatiblity problems with
PyYAML. In addition, Raymond wants to kept the different versions of
collections synchronized across Python versions.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r-- | Lib/collections.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index 202b8b2..1e807af 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -99,16 +99,14 @@ class OrderedDict(dict, MutableMapping): def __reduce__(self): 'Return state information for pickling' - dictitems = self.iteritems() + 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 - # Set the state item to None when the dictionary is empty. This saves - # about 2 opcodes when the object is pickled. - if not inst_dict: - inst_dict = None - return (self.__class__, (), inst_dict, None, dictitems) + if inst_dict: + return (self.__class__, (items,), inst_dict) + return self.__class__, (items,) setdefault = MutableMapping.setdefault update = MutableMapping.update |