[issue1672332] cPickle can pickle, but cannot unpickle on 64bit machines

Mark Dickinson report at bugs.python.org
Mon Jan 5 15:07:16 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

The problem comes down to the platform strtod:  on some systems,
strtod sets errno to ERANGE on underflow.  The load_float function in
Modules/cPickle.c calls PyOS_ascii_strtod and then raises ValueError
if that call sets errno.

I suggest replacing the call to PyOS_ascii_strtod with a call to
PyFloat_FromString instead.  This would make cPickle behave identically
to pickle, and would also fix the problem on Windows where 1e-310 is
dumped as 0.0.  (PyFloat_FromString goes out of its way to use atof 
instead of strtod to deal with this case.)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1672332>
_______________________________________


More information about the Python-bugs-list mailing list