Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pickle lacks float('inf') #34850

Closed
anthonydoggett mannequin opened this issue Jul 28, 2001 · 7 comments
Closed

pickle lacks float('inf') #34850

anthonydoggett mannequin opened this issue Jul 28, 2001 · 7 comments
Labels
type-feature A feature request or enhancement

Comments

@anthonydoggett
Copy link
Mannequin

anthonydoggett mannequin commented Jul 28, 2001

BPO 445484
Nosy @gvanrossum, @tim-one, @brettcannon, @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2005-07-17.13:11:28.000>
created_at = <Date 2001-07-28.15:21:02.000>
labels = ['type-feature']
title = "pickle lacks float('inf')"
updated_at = <Date 2005-07-17.13:11:28.000>
user = 'https://bugs.python.org/anthonydoggett'

bugs.python.org fields:

activity = <Date 2005-07-17.13:11:28.000>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2001-07-28.15:21:02.000>
creator = 'anthonydoggett'
dependencies = []
files = []
hgrepos = []
issue_num = 445484
keywords = []
message_count = 7.0
messages = ['53198', '53199', '53200', '53201', '53202', '53203', '53204']
nosy_count = 5.0
nosy_names = ['gvanrossum', 'tim.peters', 'brett.cannon', 'georg.brandl', 'anthonydoggett']
pr_nums = []
priority = 'low'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue445484'
versions = []

@anthonydoggett
Copy link
Mannequin Author

anthonydoggett mannequin commented Jul 28, 2001

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)

@anthonydoggett anthonydoggett mannequin closed this as completed Jul 28, 2001
@anthonydoggett anthonydoggett mannequin added the type-feature A feature request or enhancement label Jul 28, 2001
@anthonydoggett anthonydoggett mannequin closed this as completed Jul 28, 2001
@anthonydoggett anthonydoggett mannequin added the type-feature A feature request or enhancement label Jul 28, 2001
@tim-one
Copy link
Member

tim-one commented Aug 1, 2001

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.

@gvanrossum
Copy link
Member

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.

@tim-one
Copy link
Member

tim-one commented Sep 5, 2001

Logged In: YES
user_id=31435

Changed to Feature Request, and added to new "Non-
accidental 754 support" section of PEP-42.

@brettcannon
Copy link
Member

Logged In: YES
user_id=357491

PEP-754 should make sure to deal with this.

@tim-one
Copy link
Member

tim-one commented May 13, 2003

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).

@birkenfeld
Copy link
Member

Logged In: YES
user_id=1188172

This is in CVS for 2.5.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants