On 15/02/2010 16:04, Dino Viehland wrote:

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.

Could the namedtuple API be changed to better support IronPython - perhaps an optional __module__ argument?

Michael

*From:* [email protected] [mailto:[email protected]] *On Behalf Of *Don Sawatzky
*Sent:* Monday, February 15, 2010 7:41 AM
*To:* [email protected]
*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
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your 
employer, to release me from all obligations and waivers arising from any and all 
NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, 
confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS 
AGREEMENTS") that I have entered into with your employer, its partners, licensors, 
agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. 
You further represent that you have the authority to release me from any BOGUS AGREEMENTS 
on behalf of your employer.


_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to