diff Python/compile.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 c497929b2371
children 8c277f29b535
line wrap: on
line diff
--- a/Python/compile.c	Fri Feb 14 22:54:21 1997 +0000
+++ b/Python/compile.c	Fri Feb 14 22:58:07 1997 +0000
@@ -782,6 +782,7 @@
 	extern double atof PROTO((const char *));
 	char *end;
 	long x;
+	double dx;
 #ifndef WITHOUT_COMPLEX
 	Py_complex c;
 	int imflag;
@@ -810,12 +811,18 @@
 #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 *