[IronPython] CPickle problem

Dino Viehland dinov at microsoft.com
Mon Feb 15 17:04:52 CET 2010

This works if you run with the -X:Frames option.  This is because namedtuple is using sys._getframe to find the calling module name and setting it on the created class.  Alternately you could do this yourself:

Point.__module__ = __name__

You could file a bug on this on CodePlex but to fix it we probably need to modify the standard library and provide an alternate namedtuple implementation which doesn't require sys._getframe.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Don Sawatzky
Sent: Monday, February 15, 2010 7:41 AM
To: users at lists.ironpython.com
Subject: [IronPython] CPickle problem

This assert works in CPython 2.6 and not in IronPython 2.6.1 RC 1 with a failure
in dumps():

from collections import namedtuple
# verify that instances can be pickled
from cPickle import loads, dumps
Point = namedtuple('Point', 'x, y', False)
p = Point(x=10, y=20)
assert p == loads(dumps(p))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100215/9864f77d/attachment.html>

More information about the Ironpython-users mailing list