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()
This commit is contained in:
Victor Stinner 2021-10-11 21:00:25 +02:00 committed by GitHub
parent 659812b451
commit 2f92e2a590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 99 additions and 113 deletions

View file

@ -1,10 +1,11 @@
#include "Python.h"
#include "pycore_pymath.h" // _Py_InIntegralTypeRange()
#ifdef MS_WINDOWS
#include <winsock2.h> /* struct timeval */
# include <winsock2.h> // struct timeval
#endif
#if defined(__APPLE__)
#include <mach/mach_time.h> /* mach_absolute_time(), mach_timebase_info() */
# include <mach/mach_time.h> // mach_absolute_time(), mach_timebase_info()
#if defined(__APPLE__) && defined(__has_builtin)
# if __has_builtin(__builtin_available)