summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-05-08 15:19:57 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-05-08 15:19:57 (GMT)
commit72f98e9b838ce73142e3bb89c4c7fde3266d475e (patch)
treeee5028c0b885ff1d7bd6d0efb5d842de50efcec6 /Python/marshal.c
parent569c09c013b9fd88dd5f815a91ab1af4026d8a86 (diff)
downloadcpython-72f98e9b838ce73142e3bb89c4c7fde3266d475e.zip
cpython-72f98e9b838ce73142e3bb89c4c7fde3266d475e.tar.gz
cpython-72f98e9b838ce73142e3bb89c4c7fde3266d475e.tar.bz2
SF bug #422177: Results from .pyc differs from .py
Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 120c3fa..7cd84f6 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -149,9 +149,8 @@ w_object(PyObject *v, WFILE *p)
w_short(ob->ob_digit[i], p);
}
else if (PyFloat_Check(v)) {
- extern void PyFloat_AsString(char *, PyFloatObject *);
char buf[256]; /* Plenty to format any double */
- PyFloat_AsString(buf, (PyFloatObject *)v);
+ PyFloat_AsReprString(buf, (PyFloatObject *)v);
n = strlen(buf);
w_byte(TYPE_FLOAT, p);
w_byte(n, p);
@@ -159,20 +158,19 @@ w_object(PyObject *v, WFILE *p)
}
#ifndef WITHOUT_COMPLEX
else if (PyComplex_Check(v)) {
- extern void PyFloat_AsString(char *, PyFloatObject *);
char buf[256]; /* Plenty to format any double */
PyFloatObject *temp;
w_byte(TYPE_COMPLEX, p);
temp = (PyFloatObject*)PyFloat_FromDouble(
PyComplex_RealAsDouble(v));
- PyFloat_AsString(buf, temp);
+ PyFloat_AsReprString(buf, temp);
Py_DECREF(temp);
n = strlen(buf);
w_byte(n, p);
w_string(buf, n, p);
temp = (PyFloatObject*)PyFloat_FromDouble(
PyComplex_ImagAsDouble(v));
- PyFloat_AsString(buf, temp);
+ PyFloat_AsReprString(buf, temp);
Py_DECREF(temp);
n = strlen(buf);
w_byte(n, p);