Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue23096

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Implementation-depended pickling floats with protocol 0
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: alexandre.vassalotti, pitrou, python-dev, serhiy.storchaka
Priority:normalKeywords:patch

Created on2014-12-21 08:10 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
pickle_float_repr.patchserhiy.storchaka,2015-02-08 08:56review
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 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
DateUserActionArgs
2022-04-11 14:58:11adminsetgithub: 67285
2015-02-15 12:35:43serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2015-02-15 12:34:41python-devsetnosy: +python-dev
messages: +msg236034
2015-02-15 12:07:42serhiy.storchakasetassignee:serhiy.storchaka
2015-02-08 08:56:57serhiy.storchakasetfiles: +pickle_float_repr.patch
versions: - Python 2.7, Python 3.4
messages: +msg235550

keywords: +patch
stage: patch review
2014-12-22 22:58:17pitrousetmessages: +msg233027
2014-12-22 20:13:36alexandre.vassalottisetmessages: +msg233024
2014-12-21 08:58:21serhiy.storchakasetmessages: +msg232995
2014-12-21 08:10:33serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp