Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 14851:5449302c4d2e legacy-trunk
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.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Mon, 25 Sep 2000 21:01:28 +0000 |
| parents | 77eddddbb7cc |
| children | 25ddd3dc7a7a |
line wrap: on
line diff
--- a/Objects/floatobject.c Mon Sep 25 18:26:21 2000 +0000 +++ b/Objects/floatobject.c Mon Sep 25 21:01:28 2000 +0000 @@ -182,7 +182,9 @@ * 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 @@ 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);
