diff Objects/floatobject.c @ 53442:6947bc3dd433 legacy-trunk

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.
author Eric Smith <eric@trueblade.com>
date Sat, 25 Apr 2009 21:40:15 +0000
parents 6bcdc131f53c
children 01c3363a357f
line wrap: on
line diff
--- a/Objects/floatobject.c	Sat Apr 25 21:16:05 2009 +0000
+++ b/Objects/floatobject.c	Sat Apr 25 21:40:15 2009 +0000
@@ -342,7 +342,6 @@
 format_float(char *buf, size_t buflen, PyFloatObject *v, int precision)
 {
 	register char *cp;
-	char format[32];
 	int i;
 
 	/* Subroutine for float_repr and float_print.
@@ -352,8 +351,8 @@
 	   in such cases, we append ".0" to the string. */
 
 	assert(PyFloat_Check(v));
-	PyOS_snprintf(format, 32, "%%.%ig", precision);
-	PyOS_ascii_formatd(buf, buflen, format, v->ob_fval);
+	_PyOS_double_to_string(buf, buflen, v->ob_fval, 'g', precision,
+                               0, NULL);
 	cp = buf;
 	if (*cp == '-')
 		cp++;