diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-20 01:51:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 01:51:30 (GMT) |
commit | be143ec99674ba38c5811f34cdb85ef39c2dc8f8 (patch) | |
tree | fb6f916b483c7dd7506d92899604cd17a4344e0d /Modules/cmathmodule.c | |
parent | 01b1cc12e7c6a3d6a3d27ba7c731687d57aae92a (diff) | |
download | cpython-be143ec99674ba38c5811f34cdb85ef39c2dc8f8.zip cpython-be143ec99674ba38c5811f34cdb85ef39c2dc8f8.tar.gz cpython-be143ec99674ba38c5811f34cdb85ef39c2dc8f8.tar.bz2 |
bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty:
they have been doing nothing for the last year (since commit
735ae8d139a673b30b321dc10acfd3d14f0d633b), so stop using them.
Diffstat (limited to 'Modules/cmathmodule.c')
-rw-r--r-- | Modules/cmathmodule.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 02c09bb..8b21dec 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -17,7 +17,7 @@ module cmath /*[python input] class Py_complex_protected_converter(Py_complex_converter): def modify(self): - return 'errno = 0; PyFPE_START_PROTECT("complex function", goto exit);' + return 'errno = 0;' class Py_complex_protected_return_converter(CReturnConverter): @@ -26,7 +26,6 @@ class Py_complex_protected_return_converter(CReturnConverter): def render(self, function, data): self.declare(data) data.return_conversion.append(""" -PyFPE_END_PROTECT(_return_value); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; @@ -40,7 +39,7 @@ else { } """.strip()) [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=345daa075b1028e7]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=8b27adb674c08321]*/ #if (FLT_RADIX != 2 && FLT_RADIX != 16) #error "Modules/cmathmodule.c expects FLT_RADIX to be 2 or 16" @@ -960,7 +959,6 @@ cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj) Py_complex y; errno = 0; - PyFPE_START_PROTECT("complex function", return 0) x = c_log(x); if (y_obj != NULL) { y = PyComplex_AsCComplex(y_obj); @@ -970,7 +968,6 @@ cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj) y = c_log(y); x = _Py_c_quot(x, y); } - PyFPE_END_PROTECT(x) if (errno != 0) return math_error(); return PyComplex_FromCComplex(x); @@ -1008,9 +1005,7 @@ cmath_phase_impl(PyObject *module, Py_complex z) double phi; errno = 0; - PyFPE_START_PROTECT("arg function", return 0) phi = c_atan2(z); - PyFPE_END_PROTECT(phi) if (errno != 0) return math_error(); else @@ -1035,10 +1030,8 @@ cmath_polar_impl(PyObject *module, Py_complex z) double r, phi; errno = 0; - PyFPE_START_PROTECT("polar function", return 0) phi = c_atan2(z); /* should not cause any exception */ r = _Py_c_abs(z); /* sets errno to ERANGE on overflow */ - PyFPE_END_PROTECT(r) if (errno != 0) return math_error(); else @@ -1074,7 +1067,6 @@ cmath_rect_impl(PyObject *module, double r, double phi) { Py_complex z; errno = 0; - PyFPE_START_PROTECT("rect function", return 0) /* deal with special values */ if (!Py_IS_FINITE(r) || !Py_IS_FINITE(phi)) { @@ -1116,7 +1108,6 @@ cmath_rect_impl(PyObject *module, double r, double phi) errno = 0; } - PyFPE_END_PROTECT(z) if (errno != 0) return math_error(); else |