From 73b5fcda7405afb21a32bd6845e768b7b78a0cb1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 14 Feb 1997 22:58:07 +0000 Subject: Changes for Lee Busby's SIGFPE patch set. New file pyfpe.c and exception FloatingPointError. Surround some f.p. operations with PyFPE macro brackets. --- Python/marshal.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Python/marshal.c') diff --git a/Python/marshal.c b/Python/marshal.c index 0ad493a3db..f4634f013b 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -412,6 +412,7 @@ r_object(p) { 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 @@ r_object(p) 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 @@ r_object(p) 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 @@ r_object(p) return NULL; } buf[n] = '\0'; + PyFPE_START_PROTECT("atof", return 0) c.imag = atof(buf); + PyFPE_END_PROTECT return newcomplexobject(c); } #endif -- cgit v1.2.1