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

Float infinity unpicklable with BINFLOAT-using protocols #39841

Closed
exarkun mannequin opened this issue Jan 21, 2004 · 2 comments
Closed

Float infinity unpicklable with BINFLOAT-using protocols #39841

exarkun mannequin opened this issue Jan 21, 2004 · 2 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@exarkun
Copy link
Mannequin

exarkun mannequin commented Jan 21, 2004

BPO 880990
Nosy @tim-one

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 = 'https://github.com/tim-one'
closed_at = <Date 2004-01-21.01:28:31.000>
created_at = <Date 2004-01-21.00:20:07.000>
labels = ['library']
title = 'Float infinity unpicklable with BINFLOAT-using protocols'
updated_at = <Date 2004-01-21.01:28:31.000>
user = 'https://bugs.python.org/exarkun'

bugs.python.org fields:

activity = <Date 2004-01-21.01:28:31.000>
actor = 'tim.peters'
assignee = 'tim.peters'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2004-01-21.00:20:07.000>
creator = 'exarkun'
dependencies = []
files = []
hgrepos = []
issue_num = 880990
keywords = []
message_count = 2.0
messages = ['19730', '19731']
nosy_count = 2.0
nosy_names = ['tim.peters', 'exarkun']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue880990'
versions = ['Python 2.3']

@exarkun
Copy link
Mannequin Author

exarkun mannequin commented Jan 21, 2004

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

Prior to BINFLOAT, float infinity could successfully be
pickled. The right thing to do here seems to be to
catch the exception and fall back to a FLOAT (string
representation) token.

@exarkun exarkun mannequin closed this as completed Jan 21, 2004
@exarkun exarkun mannequin assigned tim-one Jan 21, 2004
@exarkun exarkun mannequin added the stdlib Python modules in the Lib dir label Jan 21, 2004
@exarkun exarkun mannequin closed this as completed Jan 21, 2004
@exarkun exarkun mannequin assigned tim-one Jan 21, 2004
@exarkun exarkun mannequin added the stdlib Python modules in the Lib dir label Jan 21, 2004
@tim-one
Copy link
Member

tim-one commented Jan 21, 2004

Logged In: YES
user_id=31435

Closed as Duplicate. See
<http://www.python.org/sf/445484\>. The feature request is
part of PEP-42. Python currently has no support for infinities,
NaNs, or signed zeroes in pickles; if you think you saw one of
those work now, it's a platform accident (in particular,
whether the string form of an infinity works depends entirely
on your platform C library, and such pickles are not portable).

@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
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

1 participant