cpython: 18303391b981 (original) (raw)

Mercurial > cpython

changeset 83591:18303391b981 2.7

Issue #15535: Fix regression in pickling of named tuples. [#15535]

Raymond Hettinger python@rcn.com
date Fri, 03 May 2013 00:59:20 -0700
parents c3656dca65e7
children 26068bfec70e
files Doc/library/collections.rst Lib/collections.py Lib/test/test_collections.py Misc/NEWS
diffstat 4 files changed, 5 insertions(+), 6 deletions(-)[+] [-] Doc/library/collections.rst 4 Lib/collections.py 2 Lib/test/test_collections.py 2 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -628,9 +628,7 @@ Example: 'Return a new OrderedDict which maps field names to their values' return OrderedDict(zip(self._fields, self))

--- a/Lib/collections.py +++ b/Lib/collections.py @@ -259,8 +259,6 @@ class {typename}(tuple): 'Return a new OrderedDict which maps field names to their values' return OrderedDict(zip(self._fields, self))

- def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self))

--- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -78,12 +78,12 @@ class TestNamedTuple(unittest.TestCase): self.assertRaises(TypeError, eval, 'Point(XXX=1, y=2)', locals()) # wrong keyword argument self.assertRaises(TypeError, eval, 'Point(x=1)', locals()) # missing keyword argument self.assertEqual(repr(p), 'Point(x=11, y=22)')

try: p._replace(x=1, error=2)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -17,6 +17,9 @@ Build Core and Builtins ----------------- +- Issue #15535: Fixed regression in the pickling of named tuples by