[Python-checkins] cpython: Issue #23096: Pickle representation of floats with protocol 0 now is the same

serhiy.storchaka python-checkins at python.org
Sun Feb 15 13:39:23 CET 2015


https://hg.python.org/cpython/rev/8c9121993eb5
changeset:   94632:8c9121993eb5
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Feb 15 14:18:32 2015 +0200
summary:
  Issue #23096: Pickle representation of floats with protocol 0 now is the same
for both Python and C implementations.

files:
  Misc/NEWS         |  3 +++
  Modules/_pickle.c |  2 +-
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@
 Library
 -------
 
+- Issue #23096: Pickle representation of floats with protocol 0 now is the same
+  for both Python and C implementations.
+
 - Issue #19105: pprint now more efficiently uses free space at the right.
 
 - Issue #14910: Add allow_abbrev parameter to argparse.ArgumentParser. Patch by
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1979,7 +1979,7 @@
         if (_Pickler_Write(self, &op, 1) < 0)
             goto done;
 
-        buf = PyOS_double_to_string(x, 'g', 17, 0, NULL);
+        buf = PyOS_double_to_string(x, 'r', 0, Py_DTSF_ADD_DOT_0, NULL);
         if (!buf) {
             PyErr_NoMemory();
             goto done;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list