
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-12-21 08:10 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| 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)*![]() | 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)*![]() | Date: 2014-12-21 08:58 | |
Python implementation uses repr(value) and C implementation uses '%.17g' % value. | |||
| msg233024 -(view) | Author: Alexandre Vassalotti (alexandre.vassalotti)*![]() | 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)*![]() | Date: 2014-12-22 22:58 | |
This looks less like a bug than an enhancement request. | |||
| msg235550 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2015-02-08 08:56 | |
Here is a patch. | |||
| msg236034 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-02-15 12:34 | |
New changeset8c9121993eb5 by Serhiy Storchaka in branch 'default':Issue#23096: Pickle representation of floats with protocol 0 now is the samehttps://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 | |