Mercurial > cpython-lru_cache-weakref
changeset 83592:65cd71abebc8 3.3
Issue #15535: Fix pickling of named tuples.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 03 May 2013 02:24:15 -0700 |
| parents | 9cb90c1a1a46 |
| children | 09c6faf1877c c0a21617dbee |
| files | Lib/collections/__init__.py Lib/test/test_collections.py Misc/ACKS Misc/NEWS |
| diffstat | 4 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/collections/__init__.py Wed May 01 16:18:25 2013 +0300 +++ b/Lib/collections/__init__.py Fri May 03 02:24:15 2013 -0700 @@ -281,6 +281,10 @@ 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) + def __getstate__(self): + 'Exclude the OrderedDict from pickling' + return None + {field_defs} '''
--- a/Lib/test/test_collections.py Wed May 01 16:18:25 2013 +0300 +++ b/Lib/test/test_collections.py Fri May 03 02:24:15 2013 -0700 @@ -273,6 +273,7 @@ q = loads(dumps(p, protocol)) self.assertEqual(p, q) self.assertEqual(p._fields, q._fields) + self.assertNotIn(b'OrderedDict', dumps(p, protocol)) def test_copy(self): p = TestNT(x=10, y=20, z=30)
--- a/Misc/ACKS Wed May 01 16:18:25 2013 +0300 +++ b/Misc/ACKS Fri May 03 02:24:15 2013 -0700 @@ -811,6 +811,7 @@ Jason Michalski Franck Michea Tom Middleton +Thomas Miedema Stan Mihai Stefan Mihaila Aristotelis Mikropoulos
--- a/Misc/NEWS Wed May 01 16:18:25 2013 +0300 +++ b/Misc/NEWS Fri May 03 02:24:15 2013 -0700 @@ -47,6 +47,9 @@ - Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by Thomas Barlow. +- Issue #15535: Fix namedtuple pickles which were picking up the OrderedDict + instead of just the underlying tuple. + - Issue #17192: Restore the patch for Issue #11729 which was ommitted in 3.3.1 when updating the bundled version of libffi used by ctypes. Update many libffi files that were missed in 3.3.1's update to libffi-3.0.13.
