[Patches] [ python-Patches-1180995 ] binary formats for marshalling floats

SourceForge.net noreply at sourceforge.net
Mon Apr 11 21:50:33 CEST 2005


Patches item #1180995, was opened at 2005-04-11 20:50
Message generated for change (Tracker Item Submitted) made by Item Submitter
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



----------------------------------------------------------------------

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