Skip to content

Commit a4554ee

Browse files
committed
Removed PyOS_ascii_atof from ast.c, as mentioned in issue 7117.
1 parent 54e8c6c commit a4554ee

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Python/ast.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,17 +3236,17 @@ parsenumber(struct compiling *c, const char *s)
32363236
#ifndef WITHOUT_COMPLEX
32373237
if (imflag) {
32383238
complex.real = 0.;
3239-
PyFPE_START_PROTECT("atof", return 0)
3240-
complex.imag = PyOS_ascii_atof(s);
3241-
PyFPE_END_PROTECT(complex)
3239+
complex.imag = PyOS_string_to_double(s, (char **)&end, NULL);
3240+
if (complex.imag == -1.0 && PyErr_Occurred())
3241+
return NULL;
32423242
return PyComplex_FromCComplex(complex);
32433243
}
32443244
else
32453245
#endif
32463246
{
3247-
PyFPE_START_PROTECT("atof", return 0)
3248-
dx = PyOS_ascii_atof(s);
3249-
PyFPE_END_PROTECT(dx)
3247+
dx = PyOS_string_to_double(s, NULL, NULL);
3248+
if (dx == -1.0 && PyErr_Occurred())
3249+
return NULL;
32503250
return PyFloat_FromDouble(dx);
32513251
}
32523252
}

0 commit comments

Comments
 (0)