Kaydet (Commit) 3e09f43e authored tarafından Mark Dickinson's avatar Mark Dickinson

Make sure that marshal and pickle continue to output 17

digits of precision for floats.
üst 8648e501
...@@ -1025,7 +1025,7 @@ save_float(PicklerObject *self, PyObject *obj) ...@@ -1025,7 +1025,7 @@ save_float(PicklerObject *self, PyObject *obj)
if (pickler_write(self, &op, 1) < 0) if (pickler_write(self, &op, 1) < 0)
goto done; goto done;
buf = PyOS_double_to_string(x, 'r', 0, 0, NULL); buf = PyOS_double_to_string(x, 'g', 17, 0, NULL);
if (!buf) { if (!buf) {
PyErr_NoMemory(); PyErr_NoMemory();
goto done; goto done;
......
...@@ -237,7 +237,7 @@ w_object(PyObject *v, WFILE *p) ...@@ -237,7 +237,7 @@ w_object(PyObject *v, WFILE *p)
} }
else { else {
char *buf = PyOS_double_to_string(PyFloat_AS_DOUBLE(v), char *buf = PyOS_double_to_string(PyFloat_AS_DOUBLE(v),
'r', 0, 0, NULL); 'g', 17, 0, NULL);
if (!buf) if (!buf)
return; return;
n = strlen(buf); n = strlen(buf);
...@@ -269,7 +269,7 @@ w_object(PyObject *v, WFILE *p) ...@@ -269,7 +269,7 @@ w_object(PyObject *v, WFILE *p)
char *buf; char *buf;
w_byte(TYPE_COMPLEX, p); w_byte(TYPE_COMPLEX, p);
buf = PyOS_double_to_string(PyComplex_RealAsDouble(v), buf = PyOS_double_to_string(PyComplex_RealAsDouble(v),
'r', 0, 0, NULL); 'g', 17, 0, NULL);
if (!buf) if (!buf)
return; return;
n = strlen(buf); n = strlen(buf);
...@@ -277,7 +277,7 @@ w_object(PyObject *v, WFILE *p) ...@@ -277,7 +277,7 @@ w_object(PyObject *v, WFILE *p)
w_string(buf, (int)n, p); w_string(buf, (int)n, p);
PyMem_Free(buf); PyMem_Free(buf);
buf = PyOS_double_to_string(PyComplex_ImagAsDouble(v), buf = PyOS_double_to_string(PyComplex_ImagAsDouble(v),
'r', 0, 0, NULL); 'g', 17, 0, NULL);
if (!buf) if (!buf)
return; return;
n = strlen(buf); n = strlen(buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment