[IronPython] Pickle bug
Curt Hagenlocher
curt at hagenlocher.org
Thu Sep 4 16:46:25 CEST 2008
Yes, we should probably change this to use System.Double.ToString('G17')
On Thu, Sep 4, 2008 at 7:41 AM, Christian Muirhead <
christian.muirhead at resolversystems.com> wrote:
> Michael Foord wrote:
>
>> Pickle on IronPython doesn't preserve sufficient information to unpickle
>> floats accurately:
>>
>> CPython:
>> >>> a = 1 /3.0
>> >>> import cPickle as pickle
>> >>> pickle.loads(pickle.dumps(a)) == a
>>
> (Michael meant to say that this was True)
>
>>
>> IronPython:
>> >>> import cPickle as pickle
>> >>> a = 1 /3.0
>> >>> pickle.loads(pickle.dumps(a)) == a
>> False
>>
>> This is actually causing us numerical errors in Resolver One. CPython is
>> actually very careful about its string representation of floats so that this
>> is possible.
>>
>
> I think it's because IP cPickle is relying on the .NET Double.ToString
> which isn't as truthful as cPython's repr.
>
> The issue's covered here:
> http://www.python.org/doc/current/tut/node16.html
>
> xtian
>
>
> --
> Christian Muirhead
> Resolver Systems
> christian.muirhead at resolversystems.com
> We're hiring! http://www.resolversystems.com/jobs/
>
>
> Resolver Systems Ltd
> 17a Clerkenwell Road, London EC1M 5RD, UK
> VAT No.: GB 893 5643 79 Registered in England and Wales as company number
> 5467329.
> Registered address: 843 Finchley Road, London NW11 8NA, UK
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080904/e60ebcb9/attachment.html>
More information about the Ironpython-users
mailing list