| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dd62966 commit abc9f70
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3236,17 +3236,17 @@ parsenumber(struct compiling *c, const char *s) | |||
| 3236 | 3236 | #ifndef WITHOUT_COMPLEX | |
| 3237 | 3237 | if (imflag) { | |
| 3238 | 3238 | 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; | ||
| 3242 | 3242 | return PyComplex_FromCComplex(complex); | |
| 3243 | 3243 | } | |
| 3244 | 3244 | else | |
| 3245 | 3245 | #endif | |
| 3246 | 3246 | { | |
| 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; | ||
| 3250 | 3250 | return PyFloat_FromDouble(dx); | |
| 3251 | 3251 | } | |
| 3252 | 3252 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments