We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 54e8c6c commit a4554eeCopy full SHA for a4554ee
1 file changed
Python/ast.c
@@ -3236,17 +3236,17 @@ parsenumber(struct compiling *c, const char *s)
3236
#ifndef WITHOUT_COMPLEX
3237
if (imflag) {
3238
complex.real = 0.;
3239
- PyFPE_START_PROTECT("atof", return 0)
3240
- complex.imag = PyOS_ascii_atof(s);
3241
- PyFPE_END_PROTECT(complex)
+ complex.imag = PyOS_string_to_double(s, (char **)&end, NULL);
+ if (complex.imag == -1.0 && PyErr_Occurred())
+ return NULL;
3242
return PyComplex_FromCComplex(complex);
3243
}
3244
else
3245
#endif
3246
{
3247
3248
- dx = PyOS_ascii_atof(s);
3249
- PyFPE_END_PROTECT(dx)
+ dx = PyOS_string_to_double(s, NULL, NULL);
+ if (dx == -1.0 && PyErr_Occurred())
3250
return PyFloat_FromDouble(dx);
3251
3252
0 commit comments