pickle and infinity

Bart Ogryczak B.Ogryczak at gmail.com
Wed Nov 29 12:09:21 EST 2006


Hello,
I´ve got this problem with pickle, it seems it doesn´t handle
correctly infinite values (nor does Python return overflow/underflow
error). What could I do about it? Example code:

>>> x = 1e310 #actually it would be a result of calculations
>>> type(x)
<type 'float'>
>>> x
1.#INF
>>> import pickle
>>> pickle.loads(pickle.dumps(x))
[...]
ValueError: invalid literal for float(): 1.#INF




More information about the Python-list mailing list