[Python-Dev] Re: marshal / unmarshal
Tim Peters
tim.peters at gmail.com
Sun Apr 10 19:23:32 CEST 2005
marshal shouldn't be representing doubles as decimal strings to begin
with. All code for (de)serialing C doubles should go thru
_PyFloat_Pack8() and _PyFloat_Unpack8(). cPickle (proto >= 1) and
struct (std mode) already do; marshal is the oddball.
But as the docs (floatobject.h) for these say:
...
* Bug: What this does is undefined if x is a NaN or infinity.
* Bug: -0.0 and +0.0 produce the same string.
*/
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
...
* Bug: What this does is undefined if the string represents a NaN or
* infinity.
*/
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
More information about the Python-Dev
mailing list