[ python-Bugs-1611753 ] can't pickle NAN's in binary mode

SourceForge.net noreply at sourceforge.net
Fri Dec 8 19:45:47 CET 2006


Bugs item #1611753, was opened at 2006-12-08 10:45
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1611753&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Wayne Christopher (wayne606)
Assigned to: Nobody/Anonymous (nobody)
Summary: can't pickle NAN's in binary mode

Initial Comment:
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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1611753&group_id=5470


More information about the Python-bugs-list mailing list