diff options
author | Eric Smith <eric@trueblade.com> | 2009-04-25 21:40:15 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2009-04-25 21:40:15 (GMT) |
commit | 068f06568be288b8628a4e24118503e4d9b7af1b (patch) | |
tree | e1d01c08ed08489c994e7cbf167fd703c7f2c64e /Objects/stringobject.c | |
parent | dfcffd40447de8e04376f8946fb71a9c16151563 (diff) | |
download | cpython-068f06568be288b8628a4e24118503e4d9b7af1b.zip cpython-068f06568be288b8628a4e24118503e4d9b7af1b.tar.gz cpython-068f06568be288b8628a4e24118503e4d9b7af1b.tar.bz2 |
Issue #5835, deprecate PyOS_ascii_formatd.
If anyone wants to clean up the documentation, feel free. It's my first documentation foray, and it's not that great.
Will port to py3k with a different strategy.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r-- | Objects/stringobject.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 89614e6..316a271a 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -4332,9 +4332,6 @@ Py_LOCAL_INLINE(int) formatfloat(char *buf, size_t buflen, int flags, int prec, int type, PyObject *v) { - /* fmt = '%#.' + `prec` + `type` - worst case length = 3 + 10 (len of INT_MAX) + 1 = 14 (use 20)*/ - char fmt[20]; double x; x = PyFloat_AsDouble(v); if (x == -1.0 && PyErr_Occurred()) { @@ -4378,10 +4375,8 @@ formatfloat(char *buf, size_t buflen, int flags, "formatted float is too long (precision too large?)"); return -1; } - PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c", - (flags&F_ALT) ? "#" : "", - prec, type); - PyOS_ascii_formatd(buf, buflen, fmt, x); + _PyOS_double_to_string(buf, buflen, x, type, prec, + (flags&F_ALT)?Py_DTSF_ALT:0, NULL); return (int)strlen(buf); } |