This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Pickle protocols 1, 2 can't handle "inf" floats.
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: mwh Nosy List: melicertes, mwh
Priority: normal Keywords:

Created on 2005-07-06 16:03 by melicertes, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg25736 - (view) Author: Charles (melicertes) Date: 2005-07-06 16:03
Python 2.4.1 on an AMD64 system.  The pickle module
barfs with a "SystemError: frexp() result out of range"
if an "inf" float value is pickled with pickle protocol
1 or 2.  It works fine with the old protocol 0.

Minimal test case:

>>> import pickle
>>> o = 2e308
>>> print o
inf
>>> pickle.dumps(o, protocol=0)
'Finf\n.'
>>>
>>> pickle.dumps(o, protocol=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/pickle.py", line 1386, in dumps
    Pickler(file, protocol, bin).dump(obj)
  File "/usr/lib/python2.4/pickle.py", line 231, in dump
    self.save(obj)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 489, in
save_float
    self.write(BINFLOAT + pack('>d', obj))
SystemError: frexp() result out of range
>>>
>>> pickle.dumps(o, protocol=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/pickle.py", line 1386, in dumps
    Pickler(file, protocol, bin).dump(obj)
  File "/usr/lib/python2.4/pickle.py", line 231, in dump
    self.save(obj)
  File "/usr/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/usr/lib/python2.4/pickle.py", line 489, in
save_float
    self.write(BINFLOAT + pack('>d', obj))
SystemError: frexp() result out of range

msg25737 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-07-06 16:06
Logged In: YES 
user_id=6656

This is fixed in CVS.

(And also the third time I've closed this bug in the last
fortnight!  FFS guys!)
msg25738 - (view) Author: Charles (melicertes) Date: 2005-07-15 16:57
Logged In: YES 
user_id=1064824

> (And also the third time I've closed this bug in the last
> fortnight!  FFS guys!)

FFS, indeed.  Blame SourceForge's lousy search; I used the
bug tracker search to look for all (open, closed,
everything) reports for Python, all versions, keywords
"pickle" and "inf" and got zero results.  Similar searches
on "pickle" and the exception name also produced zero
results.  Call me silly, but zero search results led me to
believe that there /were/ no results.
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42165
2005-07-06 16:03:06melicertescreate