diff options
author | Tim Peters <tim.peters@gmail.com> | 2000-09-25 21:01:28 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2000-09-25 21:01:28 (GMT) |
commit | 858346e4847475137d2e8eaf5e76bfe6deacedb1 (patch) | |
tree | 917ef56655fa386affeefeaa6d5df1e48a328953 /Objects/floatobject.c | |
parent | 7f577e7fd4a06c4a6494b365a1667f8a1cedffd6 (diff) | |
download | cpython-858346e4847475137d2e8eaf5e76bfe6deacedb1.zip cpython-858346e4847475137d2e8eaf5e76bfe6deacedb1.tar.gz cpython-858346e4847475137d2e8eaf5e76bfe6deacedb1.tar.bz2 |
Replace SIGFPE paranoia around strtod and atof. I don't believe these
fncs are allowed to raise SIGFPE (see the C std), but OK by me if
people using --with-fpectl want to pay for checking anyway.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 168cbcd..004cf57 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -182,7 +182,9 @@ PyFloat_FromString(PyObject *v, char **pend) * whether strtod sets errno on underflow is not defined, so we can't * key off errno. */ + PyFPE_START_PROTECT("strtod", return NULL) x = strtod(s, (char **)&end); + PyFPE_END_PROTECT(x) errno = 0; /* Believe it or not, Solaris 2.6 can move end *beyond* the null byte at the end of the string, when the input is inf(inity). */ @@ -210,7 +212,9 @@ PyFloat_FromString(PyObject *v, char **pend) if (x == 0.0) { /* See above -- may have been strtod being anal about denorms. */ + PyFPE_START_PROTECT("atof", return NULL) x = atof(s); + PyFPE_END_PROTECT(x) errno = 0; /* whether atof ever set errno is undefined */ } return PyFloat_FromDouble(x); |