Issue3065: Fixed pickling of named tuples. Added tests.
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 @@
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: