]> granicus.if.org Git - python/commitdiff
Make sure that marshal and pickle continue to output 17
authorMark Dickinson <dickinsm@gmail.com>
Fri, 17 Apr 2009 08:41:23 +0000 (08:41 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Fri, 17 Apr 2009 08:41:23 +0000 (08:41 +0000)
digits of precision for floats.

Modules/_pickle.c
Python/marshal.c

index 20ab5257260aad0959a3f720068c0bfa00909eab..e9c4a768ccee2f99f919f65d80e2a5f3a16cd2f1 100644 (file)
@@ -1025,7 +1025,7 @@ save_float(PicklerObject *self, PyObject *obj)
         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;
index 0d551322d17d27ca42fa5169eefd414697d18646..911d2e150a05fdcab3e7a7d665835c1aa3712c39 100644 (file)
@@ -237,7 +237,7 @@ w_object(PyObject *v, WFILE *p)
                }
                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 @@ w_object(PyObject *v, WFILE *p)
                        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_object(PyObject *v, WFILE *p)
                        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);