[Python-bugs-list] [ python-Feature Requests-445484 ] pickle lacks float('inf')
SourceForge.net
noreply@sourceforge.net
Mon, 12 May 2003 18:12:42 -0700
Feature Requests item #445484, was opened at 2001-07-28 11:21
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=445484&group_id=5470
Category: None
Group: None
Status: Open
Resolution: Later
Priority: 4
Submitted By: Anthony Doggett (anthonydoggett)
Assigned to: Nobody/Anonymous (nobody)
Summary: pickle lacks float('inf')
Initial Comment:
Support for float('inf') still appears to be missing in
Python 2.1.1 (#1, Jul 28 2001, 14:15:01)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)]
on linux2
>>> cPickle.dumps(float('inf'), 1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
SystemError: frexp() result out of range
>>> pickle.dumps(float('inf'), 1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/var/ajd111/python/lib/python2.1/pickle.py",
line 943, in dumps
Pickler(file, bin).dump(object)
File "/var/ajd111/python/lib/python2.1/pickle.py",
line 109, in dump
self.save(object)
File "/var/ajd111/python/lib/python2.1/pickle.py",
line 211, in save
f(self, object)
File "/var/ajd111/python/lib/python2.1/pickle.py",
line 273, in save_float
self.write(BINFLOAT + pack('>d', object))
SystemError: frexp() result out of range
Both structmodule.c and cPickle.c require changes.
Surely something like
if (x == HUGE_VAL) { /* Inf */
e = 1024;
f = 0.0;
}
else {
f = frexp(x, &e);
...
and
if (e == 1024)
x = HUGE_VAL; /* Inf */
else {
is all that is required for all IEEE754 machines?
(structmodule.c requires similar changes for Float
also)
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2003-05-12 21:12
Message:
Logged In: YES
user_id=31435
This appears to be outside the scope of PEP 754 (as
defined by the PEP's author -- he's just aiming at symbolic
constants and inquiry functions).
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2003-05-12 20:46
Message:
Logged In: YES
user_id=357491
PEP 754 should make sure to deal with this.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-09-05 16:16
Message:
Logged In: YES
user_id=31435
Changed to Feature Request, and added to new "Non-
accidental 754 support" section of PEP 42.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-05 14:21
Message:
Logged In: YES
user_id=6380
Is there a point in keeping this bug report open
indefinitely? A "won't fix" would make just as much sense.
Maybe add Inf support to PEP 42.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-08-01 18:41
Message:
Logged In: YES
user_id=31435
Note that Python has no intentional support for Infs and
NaNs anywhere; even that float('inf') doesn't blow up when
you do it is a platform accident (it blows up ("invalid
literal") on my box).
Given that, in the absence of a comprehensive plan for
supporting this stuff across the board, and worker bees to
implement it, I downgraded the priority. A good plan would
refactor the code so that dealing with the platform double
and float formats occurs in only one place.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=445484&group_id=5470