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-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Don Sawatzky
Sent: Monday, February 15, 2010 7:41 AM
To: users@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))
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to