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.
Created on 2014年12月21日 08:10 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| pickle_float_repr.patch | serhiy.storchaka, 2015年02月08日 08:56 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg232992 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年12月21日 08:10 | |
Python and C implementations of pickle produce different results when pickle floats with protocol 0. >>> pickle.dumps(4.2, 0) b'F4.2000000000000002\n.' >>> pickle._dumps(4.2, 0) b'F4.2\n.' |
|||
| msg232995 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年12月21日 08:58 | |
Python implementation uses repr(value) and C implementation uses '%.17g' % value. |
|||
| msg233024 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) | Date: 2014年12月22日 20:13 | |
The repr for floats was changed some time ago to use a shorter decimal strings when possible. Both representations should yield the same float value once decoded. If we want to make the C and Python implementations of pickle consistent, then we should pick on what the Python version does currently: i.e., call repr on the float. |
|||
| msg233027 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2014年12月22日 22:58 | |
This looks less like a bug than an enhancement request. |
|||
| msg235550 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年02月08日 08:56 | |
Here is a patch. |
|||
| msg236034 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年02月15日 12:34 | |
New changeset 8c9121993eb5 by Serhiy Storchaka in branch 'default': Issue #23096: Pickle representation of floats with protocol 0 now is the same https://hg.python.org/cpython/rev/8c9121993eb5 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:11 | admin | set | github: 67285 |
| 2015年02月15日 12:35:43 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2015年02月15日 12:34:41 | python-dev | set | nosy:
+ python-dev messages: + msg236034 |
| 2015年02月15日 12:07:42 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2015年02月08日 08:56:57 | serhiy.storchaka | set | files:
+ pickle_float_repr.patch versions: - Python 2.7, Python 3.4 messages: + msg235550 keywords: + patch stage: patch review |
| 2014年12月22日 22:58:17 | pitrou | set | messages: + msg233027 |
| 2014年12月22日 20:13:36 | alexandre.vassalotti | set | messages: + msg233024 |
| 2014年12月21日 08:58:21 | serhiy.storchaka | set | messages: + msg232995 |
| 2014年12月21日 08:10:33 | serhiy.storchaka | create | |