[Python-Dev] Re: Re: marshal / unmarshal

Fredrik Lundh fredrik at pythonware.com
Sat Apr 9 18:36:48 CEST 2005

> pickle doesn't have the INF=>1.0 bug:
>>>> import pickle
>>>> pickle.loads(pickle.dumps(1e10000))
> ...
> ValueError: invalid literal for float(): 1.#INF
>>>> import cPickle
>>>> cPickle.loads(cPickle.dumps(1e10000))
> ...
> ValueError: could not convert string to float
>>>> import marshal
>>>> marshal.loads(marshal.dumps(1e10000))
> 1.0

should I check in a fix for this?

the code in PyFloat_FromString contains lots of trickery to deal with more or less
broken literals, and more or less broken C libraries.

unfortunately, and unlike most other functions with similar names, PyFloat_FromString
takes a Python object, not a char pointer.  would it be a good idea to add a variant
that takes a char*?  if so, should PyFloat_FromString use the new function, or are we
avoiding that kind of refactoring for speed reasons these days?

any opinions?


More information about the Python-Dev mailing list