[Patches] [ python-Patches-1180995 ] binary formats for marshalling
floats
SourceForge.net
noreply at sourceforge.net
Mon Apr 11 22:10:04 CEST 2005
Patches item #1180995, was opened at 2005-04-11 15:50
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1180995&group_id=5470
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Hudson (mwh)
Assigned to: Nobody/Anonymous (nobody)
Summary: binary formats for marshalling floats
Initial Comment:
This patch makes marshal.c use a binary format for floats when
version > 1 using _PyFloat_Pack8, _PyFloat_Unpack8 (as
suggested on python-dev).
It doesn't actually update the default version yet, so you have to be
explicit about it:
>>> marshal.dumps(1.0, 2)
'g\x00\x00\x00\x00\x00\x00\xf0?'
This almost certainly falls in the realm of platform-depedent accident
-- what does frexp do with special values? -- but on my system:
>>> inf = 1e308*1e308
>>> inf
inf
>>> marshal.dumps(inf, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: unmarshallable object
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2005-04-11 16:10
Message:
Logged In: YES
user_id=31435
Yes, C89 says nothing about what frexp() does in the
presence of infinities, NaNs or signed zeroes. That's why
whether pickling/unpickling (proto >= 1), or struct
packing/unpacking (std mode), such things appears to work--
or how it fails --have always been platform-dependent
accidents,
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1180995&group_id=5470
More information about the Patches
mailing list