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: can't pickle NAN's in binary mode
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: mwh Nosy List: mwh, wayne606
Priority: normal Keywords:

Created on 2006-12-08 18:45 by wayne606, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg30763 - (view) Author: Wayne Christopher (wayne606) Date: 2006-12-08 18:45
I think the problem is that pack(">d", float("nan")) does not work.  Same for Inf.  This works fine with pickle in ascii mode.  I tried this on SuSE 10.0, x86_64.

Python 2.4.2 (#2, Sep 10 2006, 23:53:27)
[GCC 4.1.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> foo = [1, 2, float("nan")]
>>> foo
[1, 2, nan]
>>> fp = file("/tmp/xxx", "wb")
>>> pickle.dump(foo, fp, -1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/software/64/lib/python2.4/pickle.py", line 1382, in dump
    Pickler(file, protocol, bin).dump(obj)
  File "/home/software/64/lib/python2.4/pickle.py", line 231, in dump
    self.save(obj)
  File "/home/software/64/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/home/software/64/lib/python2.4/pickle.py", line 614, in save_list
    self._batch_appends(iter(obj))
  File "/home/software/64/lib/python2.4/pickle.py", line 647, in _batch_appends
    save(x)
  File "/home/software/64/lib/python2.4/pickle.py", line 293, in save
    f(self, obj) # Call unbound method with explicit self
  File "/home/software/64/lib/python2.4/pickle.py", line 489, in save_float
    self.write(BINFLOAT + pack('>d', obj))
SystemError: frexp() result out of range
msg30764 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2006-12-09 14:37
This is fixed in 2.5 (and if you think it worked fine in ASCII mode, I don't think you tried moving your pickles between Linux and Windows systems...).
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44317
2006-12-08 18:45:47wayne606create