Mercurial > cpython-lru_cache-weakref
diff Python/marshal.c @ 5119:bda01a374762 legacy-trunk
Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.c and exception FloatingPointError.
Surround some f.p. operations with PyFPE macro brackets.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 14 Feb 1997 22:58:07 +0000 |
| parents | e3ab48988c77 |
| children | 74c12704a0bd |
line wrap: on
line diff
--- a/Python/marshal.c Fri Feb 14 22:54:21 1997 +0000 +++ b/Python/marshal.c Fri Feb 14 22:58:07 1997 +0000 @@ -412,6 +412,7 @@ { extern double atof PROTO((const char *)); char buf[256]; + double dx; n = r_byte(p); if (r_string(buf, (int)n, p) != n) { err_setstr(EOFError, @@ -419,7 +420,10 @@ return NULL; } buf[n] = '\0'; - return newfloatobject(atof(buf)); + PyFPE_START_PROTECT("atof", return 0) + dx = atof(buf); + PyFPE_END_PROTECT + return newfloatobject(dx); } #ifndef WITHOUT_COMPLEX @@ -435,7 +439,9 @@ return NULL; } buf[n] = '\0'; + PyFPE_START_PROTECT("atof", return 0) c.real = atof(buf); + PyFPE_END_PROTECT n = r_byte(p); if (r_string(buf, (int)n, p) != n) { err_setstr(EOFError, @@ -443,7 +449,9 @@ return NULL; } buf[n] = '\0'; + PyFPE_START_PROTECT("atof", return 0) c.imag = atof(buf); + PyFPE_END_PROTECT return newcomplexobject(c); } #endif
