This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexandre.vassalotti
Recipients alexandre.vassalotti, rhettinger
Date 2008-06-08.23:54:12
SpamBayes Score 9.242081e-06
Marked as misclassified No
Message-id <1212969254.61.0.946531358999.issue3065@psf.upfronthosting.co.za>
In-reply-to
Content
There is currently a pickling bug in the namedtuple factory:

  >>> from collections import namedtuple
  >>> MemoRecord = namedtuple("MemoRecord", "key, msg")
  >>> m = MemoRecord(1,"hello")
  >>> import pickle
  >>> pickle.loads(pickle.dumps(m))
  Traceback (most recent call last):
    ...
  TypeError: __new__() takes exactly 3 positional arguments (2 given)

The bug is due to the fact that classes created by namedtuple don't
handle the __new__ arguments in the same fashion as tuple.__new__. The
fix is simply to define __getnewargs__.
History
Date User Action Args
2008-06-08 23:54:15alexandre.vassalottisetspambayes_score: 9.24208e-06 -> 9.242081e-06
recipients: + alexandre.vassalotti, rhettinger
2008-06-08 23:54:14alexandre.vassalottisetspambayes_score: 9.24208e-06 -> 9.24208e-06
messageid: <1212969254.61.0.946531358999.issue3065@psf.upfronthosting.co.za>
2008-06-08 23:54:13alexandre.vassalottilinkissue3065 messages
2008-06-08 23:54:12alexandre.vassalotticreate