summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-12-28 04:45:06 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-12-28 04:45:06 (GMT)
commit545686b279ef382ec35aa12afa1f9271ce6d5109 (patch)
treea6e1a5c767667bb4cab63e8f50e9dc1f564c3810 /Python/marshal.c
parent51d00223c35f9e8f983cc7d1cb8ba1c62b86355a (diff)
downloadcpython-545686b279ef382ec35aa12afa1f9271ce6d5109.zip
cpython-545686b279ef382ec35aa12afa1f9271ce6d5109.tar.gz
cpython-545686b279ef382ec35aa12afa1f9271ce6d5109.tar.bz2
Remove PyFloat_AsReprString() and PyFloat_AsString() which should not
have been public due to passing buffers without lengths.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 4e02ac6..1819eac 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -182,8 +182,8 @@ w_object(PyObject *v, WFILE *p)
}
else {
char buf[256]; /* Plenty to format any double */
- PyFloat_AsReprString(buf, (PyFloatObject *)v);
- n = strlen(buf);
+ n = _PyFloat_Repr(PyFloat_AS_DOUBLE(v),
+ buf, sizeof(buf));
w_byte(TYPE_FLOAT, p);
w_byte((int)n, p);
w_string(buf, (int)n, p);
@@ -209,28 +209,14 @@ w_object(PyObject *v, WFILE *p)
}
else {
char buf[256]; /* Plenty to format any double */
- PyFloatObject *temp;
w_byte(TYPE_COMPLEX, p);
- temp = (PyFloatObject*)PyFloat_FromDouble(
- PyComplex_RealAsDouble(v));
- if (!temp) {
- p->error = 1;
- return;
- }
- PyFloat_AsReprString(buf, temp);
- Py_DECREF(temp);
+ n = _PyFloat_Repr(PyComplex_RealAsDouble(v),
+ buf, sizeof(buf));
n = strlen(buf);
w_byte((int)n, p);
w_string(buf, (int)n, p);
- temp = (PyFloatObject*)PyFloat_FromDouble(
- PyComplex_ImagAsDouble(v));
- if (!temp) {
- p->error = 1;
- return;
- }
- PyFloat_AsReprString(buf, temp);
- Py_DECREF(temp);
- n = strlen(buf);
+ n = _PyFloat_Repr(PyComplex_ImagAsDouble(v),
+ buf, sizeof(buf));
w_byte((int)n, p);
w_string(buf, (int)n, p);
}