diff options
author | Raymond Hettinger <python@rcn.com> | 2008-06-09 01:28:30 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-06-09 01:28:30 (GMT) |
commit | e98839a1f48b2915f1cc747884e64f4d6e4c8e7a (patch) | |
tree | c4ae6eafe55d4bd16e295b32c4334bb2cd57a7e6 /Lib/collections.py | |
parent | f4fcdb6b8c0ee8bc4d2eee5ea3b848a4cd905ad6 (diff) | |
download | cpython-e98839a1f48b2915f1cc747884e64f4d6e4c8e7a.zip cpython-e98839a1f48b2915f1cc747884e64f4d6e4c8e7a.tar.gz cpython-e98839a1f48b2915f1cc747884e64f4d6e4c8e7a.tar.bz2 |
Issue3065: Fixed pickling of named tuples. Added tests.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r-- | Lib/collections.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index f6233a7..2408818 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -82,7 +82,9 @@ def namedtuple(typename, field_names, verbose=False): result = self._make(map(kwds.pop, %(field_names)r, self)) if kwds: raise ValueError('Got unexpected field names: %%r' %% kwds.keys()) - return result \n\n''' % locals() + return result \n + def __getnewargs__(self): + return tuple(self) \n\n''' % locals() for i, name in enumerate(field_names): template += ' %s = property(itemgetter(%d))\n' % (name, i) if verbose: |