summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index e06f345358..0ee5519532 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -782,6 +782,7 @@ parsenumber(co, s)
extern double atof PROTO((const char *));
char *end;
long x;
+ double dx;
#ifndef WITHOUT_COMPLEX
Py_complex c;
int imflag;
@@ -810,12 +811,18 @@ parsenumber(co, s)
#ifndef WITHOUT_COMPLEX
if (imflag) {
c.real = 0.;
+ PyFPE_START_PROTECT("atof", return 0)
c.imag = atof(s);
+ PyFPE_END_PROTECT
return newcomplexobject(c);
}
- else
+ else {
#endif
- return newfloatobject(atof(s));
+ PyFPE_START_PROTECT("atof", return 0)
+ dx = atof(s);
+ PyFPE_END_PROTECT
+ return newfloatobject(dx);
+ }
}
static object *