summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-06-09 01:28:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-06-09 01:28:30 (GMT)
commite98839a1f48b2915f1cc747884e64f4d6e4c8e7a (patch)
treec4ae6eafe55d4bd16e295b32c4334bb2cd57a7e6 /Lib/collections.py
parentf4fcdb6b8c0ee8bc4d2eee5ea3b848a4cd905ad6 (diff)
downloadcpython-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.py4
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: