[IronPython] CPickle problem

Michael Foord fuzzyman at voidspace.org.uk
Mon Feb 15 08:16:35 PST 2010


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:* 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))
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> 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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20100215/b2e4facd/attachment.htm>


More information about the Users mailing list