[Python-checkins] r70822 - in python/branches/py3k-short-float-repr: Objects/floatobject.c Python/ast.c Python/marshal.c

mark.dickinson python-checkins at python.org
Tue Mar 31 17:12:44 CEST 2009


Author: mark.dickinson
Date: Tue Mar 31 17:12:44 2009
New Revision: 70822

Log:
Use PyOS_ascii_strtod instead of PyOS_ascii_atof in core code.

Modified:
   python/branches/py3k-short-float-repr/Objects/floatobject.c
   python/branches/py3k-short-float-repr/Python/ast.c
   python/branches/py3k-short-float-repr/Python/marshal.c

Modified: python/branches/py3k-short-float-repr/Objects/floatobject.c
==============================================================================
--- python/branches/py3k-short-float-repr/Objects/floatobject.c	(original)
+++ python/branches/py3k-short-float-repr/Objects/floatobject.c	Tue Mar 31 17:12:44 2009
@@ -262,8 +262,8 @@
 	if (x == 0.0) {
 		/* See above -- may have been strtod being anal
 		   about denorms. */
-		PyFPE_START_PROTECT("atof", goto error)
-		x = PyOS_ascii_atof(s);
+		PyFPE_START_PROTECT("strtod", goto error)
+		x = PyOS_ascii_strtod(s, NULL);
 		PyFPE_END_PROTECT(x)
 		errno = 0;    /* whether atof ever set errno is undefined */
 	}

Modified: python/branches/py3k-short-float-repr/Python/ast.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/ast.c	(original)
+++ python/branches/py3k-short-float-repr/Python/ast.c	Tue Mar 31 17:12:44 2009
@@ -3162,16 +3162,16 @@
 #ifndef WITHOUT_COMPLEX
     if (imflag) {
         compl.real = 0.;
-        PyFPE_START_PROTECT("atof", return 0)
-            compl.imag = PyOS_ascii_atof(s);
+        PyFPE_START_PROTECT("strtod", return 0)
+            compl.imag = PyOS_ascii_strtod(s, NULL);
         PyFPE_END_PROTECT(c)
             return PyComplex_FromCComplex(compl);
     }
     else
 #endif
     {
-        PyFPE_START_PROTECT("atof", return 0)
-            dx = PyOS_ascii_atof(s);
+        PyFPE_START_PROTECT("strtod", return 0)
+            dx = PyOS_ascii_strtod(s, NULL);
         PyFPE_END_PROTECT(dx)
             return PyFloat_FromDouble(dx);
     }

Modified: python/branches/py3k-short-float-repr/Python/marshal.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/marshal.c	(original)
+++ python/branches/py3k-short-float-repr/Python/marshal.c	Tue Mar 31 17:12:44 2009
@@ -666,8 +666,8 @@
 			}
 			buf[n] = '\0';
 			retval = NULL;
-			PyFPE_START_PROTECT("atof", break)
-			dx = PyOS_ascii_atof(buf);
+			PyFPE_START_PROTECT("strtod", break)
+			dx = PyOS_ascii_strtod(buf, NULL);
 			PyFPE_END_PROTECT(dx)
 			retval = PyFloat_FromDouble(dx);
 			break;
@@ -706,8 +706,8 @@
 			}
 			buf[n] = '\0';
 			retval = NULL;
-			PyFPE_START_PROTECT("atof", break;)
-			c.real = PyOS_ascii_atof(buf);
+			PyFPE_START_PROTECT("strtod", break;)
+				c.real = PyOS_ascii_strtod(buf, NULL);
 			PyFPE_END_PROTECT(c)
 			n = r_byte(p);
 			if (n == EOF || r_string(buf, (int)n, p) != n) {
@@ -717,8 +717,8 @@
 				break;
 			}
 			buf[n] = '\0';
-			PyFPE_START_PROTECT("atof", break)
-			c.imag = PyOS_ascii_atof(buf);
+			PyFPE_START_PROTECT("strtod", break)
+				c.imag = PyOS_ascii_strtod(buf, NULL);
 			PyFPE_END_PROTECT(c)
 			retval = PyComplex_FromCComplex(c);
 			break;


More information about the Python-checkins mailing list