summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-11 21:00:25 +0200
committerGitHub <noreply@github.com>2021-10-11 21:00:25 +0200
commit2f92e2a590f0e5d2d3093549f5af9a4a1889eb5a (patch)
tree0eee8237edd81885e5e6c9e70686a0c84a44c2db /Objects
parent659812b451aefe1f0e5f83540296519a5fb8f313 (diff)
downloadcpython-git-2f92e2a590f0e5d2d3093549f5af9a4a1889eb5a.tar.gz
bpo-45412: Remove Py_SET_ERRNO_ON_MATH_ERROR() macro (GH-28820)
Remove the following math macros using the errno variable: * Py_ADJUST_ERANGE1() * Py_ADJUST_ERANGE2() * Py_OVERFLOWED() * Py_SET_ERANGE_IF_OVERFLOW() * Py_SET_ERRNO_ON_MATH_ERROR() Create pycore_pymath.h internal header file. Rename Py_ADJUST_ERANGE1() and Py_ADJUST_ERANGE2() to _Py_ADJUST_ERANGE1() and _Py_ADJUST_ERANGE2(), and convert these macros to static inline functions. Move the following macros to pycore_pymath.h: * _Py_IntegralTypeSigned() * _Py_IntegralTypeMax() * _Py_IntegralTypeMin() * _Py_InIntegralTypeRange()
Diffstat (limited to 'Objects')
-rw-r--r--Objects/complexobject.c3
-rw-r--r--Objects/floatobject.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index cfe6c73757..f08f03fcb4 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -8,6 +8,7 @@
#include "Python.h"
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_object.h" // _PyObject_Init()
+#include "pycore_pymath.h" // _Py_ADJUST_ERANGE2()
#include "structmember.h" // PyMemberDef
@@ -525,7 +526,7 @@ complex_pow(PyObject *v, PyObject *w, PyObject *z)
p = _Py_c_pow(a, b);
}
- Py_ADJUST_ERANGE2(p.real, p.imag);
+ _Py_ADJUST_ERANGE2(p.real, p.imag);
if (errno == EDOM) {
PyErr_SetString(PyExc_ZeroDivisionError,
"0.0 to a negative or complex power");
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index e4ce7e74d2..d25d97f4cb 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -8,6 +8,7 @@
#include "pycore_interp.h" // _PyInterpreterState.float_state
#include "pycore_long.h" // _PyLong_GetOne()
#include "pycore_object.h" // _PyObject_Init()
+#include "pycore_pymath.h" // _Py_ADJUST_ERANGE1()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include <ctype.h>
@@ -809,7 +810,7 @@ float_pow(PyObject *v, PyObject *w, PyObject *z)
*/
errno = 0;
ix = pow(iv, iw);
- Py_ADJUST_ERANGE1(ix);
+ _Py_ADJUST_ERANGE1(ix);
if (negate_result)
ix = -ix;