[Python-checkins] r71670 - in python/branches/py3k: Modules/_pickle.c Python/marshal.c

mark.dickinson python-checkins at python.org
Fri Apr 17 10:41:24 CEST 2009


Author: mark.dickinson
Date: Fri Apr 17 10:41:23 2009
New Revision: 71670

Log:
Make sure that marshal and pickle continue to output 17
digits of precision for floats.


Modified:
   python/branches/py3k/Modules/_pickle.c
   python/branches/py3k/Python/marshal.c

Modified: python/branches/py3k/Modules/_pickle.c
==============================================================================
--- python/branches/py3k/Modules/_pickle.c	(original)
+++ python/branches/py3k/Modules/_pickle.c	Fri Apr 17 10:41:23 2009
@@ -1025,7 +1025,7 @@
         if (pickler_write(self, &op, 1) < 0)
             goto done;
 
-        buf = PyOS_double_to_string(x, 'r', 0, 0, NULL);
+        buf = PyOS_double_to_string(x, 'g', 17, 0, NULL);
         if (!buf) {
             PyErr_NoMemory();
             goto done;

Modified: python/branches/py3k/Python/marshal.c
==============================================================================
--- python/branches/py3k/Python/marshal.c	(original)
+++ python/branches/py3k/Python/marshal.c	Fri Apr 17 10:41:23 2009
@@ -237,7 +237,7 @@
 		}
 		else {
 			char *buf = PyOS_double_to_string(PyFloat_AS_DOUBLE(v),
-                                                          'r', 0, 0, NULL);
+                                                          'g', 17, 0, NULL);
 			if (!buf)
                             return;
 			n = strlen(buf);
@@ -269,7 +269,7 @@
 			char *buf;
 			w_byte(TYPE_COMPLEX, p);
 			buf = PyOS_double_to_string(PyComplex_RealAsDouble(v),
-                                                    'r', 0, 0, NULL);
+                                                    'g', 17, 0, NULL);
 			if (!buf)
                             return;
 			n = strlen(buf);
@@ -277,7 +277,7 @@
 			w_string(buf, (int)n, p);
 			PyMem_Free(buf);
 			buf = PyOS_double_to_string(PyComplex_ImagAsDouble(v),
-                                                    'r', 0, 0, NULL);
+                                                    'g', 17, 0, NULL);
 			if (!buf)
                             return;
 			n = strlen(buf);


More information about the Python-checkins mailing list