mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
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
735ae8d139
), so stop using them.
This commit is contained in:
parent
01b1cc12e7
commit
be143ec996
9 changed files with 20 additions and 101 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue