From 45b83915f8d5974045d374c981531d9b98570df1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 14 Mar 1997 04:32:50 +0000 Subject: New form of PyFPE_END_PROTECT macro. --- Modules/_tkinter.c | 2 +- Modules/cmathmodule.c | 2 +- Modules/fpetestmodule.c | 12 ++++++------ Modules/imgfile.c | 2 +- Modules/mathmodule.c | 6 +++--- Modules/mpzmodule.c | 2 +- Objects/complexobject.c | 12 ++++++------ Objects/floatobject.c | 20 ++++++++++---------- Objects/longobject.c | 2 +- Python/compile.c | 4 ++-- Python/marshal.c | 6 +++--- Python/pyfpe.c | 2 +- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 33d5392..049b292 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -730,7 +730,7 @@ Tkapp_ExprDouble (self, args) return NULL; PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0) retval = Tcl_ExprDouble (Tkapp_Interp (self), s, &v); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(retval) if (retval == TCL_ERROR) return Tkinter_Error(self); return Py_BuildValue("d", v); diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 438f010..4e08722 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -249,7 +249,7 @@ math_1(args, func) errno = 0; PyFPE_START_PROTECT("complex function", return 0) x = (*func)(x); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(x) CHECK(x.real); CHECK(x.imag); if (errno != 0) diff --git a/Modules/fpetestmodule.c b/Modules/fpetestmodule.c index 475bd7e..b568b60 100644 --- a/Modules/fpetestmodule.c +++ b/Modules/fpetestmodule.c @@ -120,11 +120,11 @@ static double nest1(int i, double x) /* This (following) message is never seen. */ PyFPE_START_PROTECT("Division by zero, inner zone", return 3.1416) a = 1./(1. - x); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(a) }else if(i == 2){ a = 1./(2. - x); } - PyFPE_END_PROTECT + PyFPE_END_PROTECT(a) return a; } @@ -140,7 +140,7 @@ static double nest2(int i, double x) }else if(i == 2){ a = 1./(2. - x); } - PyFPE_END_PROTECT + PyFPE_END_PROTECT(a) return a; } @@ -150,7 +150,7 @@ static double nest3(double x) /* This (following) message is never seen. */ PyFPE_START_PROTECT("Division by zero, nest3 error", return 3.1416) result = 1./(1. - x); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return result; } @@ -159,7 +159,7 @@ static double db0(double x) double a; PyFPE_START_PROTECT("Division by zero", return 3.1416) a = 1./x; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(a) return a; } @@ -168,7 +168,7 @@ static double overflow(double b) double a; PyFPE_START_PROTECT("Overflow", return 3.1416) a = b*b; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(a) return a; } diff --git a/Modules/imgfile.c b/Modules/imgfile.c index 779169d..865ecab 100644 --- a/Modules/imgfile.c +++ b/Modules/imgfile.c @@ -390,7 +390,7 @@ PyObject *args; PyFPE_START_PROTECT("readscaled", return 0) xfac = (float)xsize/(float)xwtd; yfac = (float)ysize/(float)ywtd; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(yfac) cdatap = PyString_AsString(rv); idatap = (long *)cdatap; diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index bb4f1e8..0df3843 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -82,7 +82,7 @@ math_1(args, func) errno = 0; PyFPE_START_PROTECT("in math_1", return 0) x = (*func)(x); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(x) CHECK(x); if (errno != 0) return math_error(); @@ -101,7 +101,7 @@ math_2(args, func) errno = 0; PyFPE_START_PROTECT("in math_2", return 0) x = (*func)(x, y); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(x) CHECK(x); if (errno != 0) return math_error(); @@ -179,7 +179,7 @@ math_ldexp(self, args) errno = 0; PyFPE_START_PROTECT("ldexp", return 0) x = ldexp(x, (int)y); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(x) CHECK(x); if (errno != 0) return math_error(); diff --git a/Modules/mpzmodule.c b/Modules/mpzmodule.c index bf83109..a2bcfed 100644 --- a/Modules/mpzmodule.c +++ b/Modules/mpzmodule.c @@ -1497,7 +1497,7 @@ mpz_float(self) mulstate *= multiplier; mpz_div_2exp(&mpzscratch, &mpzscratch, BITS_PER_MP_LIMB); } - PyFPE_END_PROTECT + PyFPE_END_PROTECT(mulstate) assert(mpz_cmp_ui(&mpzscratch, (unsigned long int)0) == 0); mpz_clear(&mpzscratch); diff --git a/Objects/complexobject.c b/Objects/complexobject.c index 212fd34..b141f2f 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -367,7 +367,7 @@ complex_add(v, w) Py_complex result; PyFPE_START_PROTECT("complex_add", return 0) result = c_sum(v->cval,w->cval); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newcomplexobject(result); } @@ -379,7 +379,7 @@ complex_sub(v, w) Py_complex result; PyFPE_START_PROTECT("complex_sub", return 0) result = c_diff(v->cval,w->cval); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newcomplexobject(result); } @@ -391,7 +391,7 @@ complex_mul(v, w) Py_complex result; PyFPE_START_PROTECT("complex_mul", return 0) result = c_prod(v->cval,w->cval); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newcomplexobject(result); } @@ -404,7 +404,7 @@ complex_div(v, w) PyFPE_START_PROTECT("complex_div", return 0) c_error = 0; quot = c_quot(v->cval,w->cval); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(quot) if (c_error == 1) { err_setstr(ZeroDivisionError, "complex division"); return NULL; @@ -480,7 +480,7 @@ complex_pow(v, w, z) else p = c_pow(v->cval,exponent); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(p) if (c_error == 2) { err_setstr(ValueError, "0.0 to a negative or complex power"); return NULL; @@ -514,7 +514,7 @@ complex_abs(v) double result; PyFPE_START_PROTECT("complex_abs", return 0) result = hypot(v->cval.real,v->cval.imag); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newfloatobject(result); } diff --git a/Objects/floatobject.c b/Objects/floatobject.c index e8d0d68..72b68a9 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -260,7 +260,7 @@ float_add(v, w) double result; PyFPE_START_PROTECT("add", return 0) result = v->ob_fval + w->ob_fval; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newfloatobject(result); } @@ -272,7 +272,7 @@ float_sub(v, w) double result; PyFPE_START_PROTECT("subtract", return 0) result = v->ob_fval - w->ob_fval; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newfloatobject(result); } @@ -285,7 +285,7 @@ float_mul(v, w) PyFPE_START_PROTECT("multiply", return 0) result = v->ob_fval * w->ob_fval; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newfloatobject(result); } @@ -301,7 +301,7 @@ float_div(v, w) } PyFPE_START_PROTECT("divide", return 0) result = v->ob_fval / w->ob_fval; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newfloatobject(result); } @@ -325,7 +325,7 @@ float_rem(v, w) mod += wx; /* div -= 1.0; */ } - PyFPE_END_PROTECT + PyFPE_END_PROTECT(mod) return newfloatobject(mod); } @@ -349,7 +349,7 @@ float_divmod(v, w) mod += wx; div -= 1.0; } - PyFPE_END_PROTECT + PyFPE_END_PROTECT(div) return mkvalue("(dd)", div, mod); } @@ -394,7 +394,7 @@ float_pow(v, w, z) if (ix!=0 && z->ob_fval<0) ix+=z->ob_fval; } else ix=1.0; - PyFPE_END_PROTECT + PyFPE_END_PROTECT(ix) return newfloatobject(ix); } errno = 0; @@ -403,7 +403,7 @@ float_pow(v, w, z) ix = powu(iv, intw); else ix = 1./powu(iv, -intw); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(ix) } else { /* Sort out special cases here instead of relying on pow() */ @@ -423,7 +423,7 @@ float_pow(v, w, z) errno = 0; PyFPE_START_PROTECT("pow", return 0) ix = pow(iv, iw); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(ix) } CHECK(ix); if (errno != 0) { @@ -438,7 +438,7 @@ float_pow(v, w, z) ((iv<0 && z->ob_fval>0) || (iv>0 && z->ob_fval<0) )) { ix+=z->ob_fval; } - PyFPE_END_PROTECT + PyFPE_END_PROTECT(ix) } return newfloatobject(ix); } diff --git a/Objects/longobject.c b/Objects/longobject.c index e0255e9..8de5456 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1421,7 +1421,7 @@ long_float(v) double result; PyFPE_START_PROTECT("long_float", return 0) result = dgetlongvalue(v); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(result) return newfloatobject(result); } diff --git a/Python/compile.c b/Python/compile.c index 9f7d1f8..3bdd994 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -818,14 +818,14 @@ parsenumber(co, s) c.real = 0.; PyFPE_START_PROTECT("atof", return 0) c.imag = atof(s); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(c) return newcomplexobject(c); } else { #endif PyFPE_START_PROTECT("atof", return 0) dx = atof(s); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(dx) return newfloatobject(dx); } } diff --git a/Python/marshal.c b/Python/marshal.c index f4634f0..22d0242 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -422,7 +422,7 @@ r_object(p) buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) dx = atof(buf); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(dx) return newfloatobject(dx); } @@ -441,7 +441,7 @@ r_object(p) buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) c.real = atof(buf); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(c) n = r_byte(p); if (r_string(buf, (int)n, p) != n) { err_setstr(EOFError, @@ -451,7 +451,7 @@ r_object(p) buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) c.imag = atof(buf); - PyFPE_END_PROTECT + PyFPE_END_PROTECT(c) return newcomplexobject(c); } #endif diff --git a/Python/pyfpe.c b/Python/pyfpe.c index 0b38997..a1de1af 100644 --- a/Python/pyfpe.c +++ b/Python/pyfpe.c @@ -12,5 +12,5 @@ #ifdef WANT_SIGFPE_HANDLER jmp_buf PyFPE_jbuf; int PyFPE_counter = 0; -double PyFPE_dummy(void){return(1.0);} +double PyFPE_dummy(){return(1.0);} #endif -- cgit v0.12