bpo-42161: Modules/ uses _PyLong_GetZero() and _PyLong_GetOne() (GH-22998)
Use _PyLong_GetZero() and _PyLong_GetOne() in Modules/ directory.
_cursesmodule.c and zoneinfo.c are now built with
Py_BUILD_CORE_MODULE macro defined.
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 9486871..e59f89b 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -8,6 +8,7 @@
#define _PY_DATETIME_IMPL
#include "Python.h"
+#include "pycore_long.h" // _PyLong_GetOne()
#include "pycore_object.h" // _PyObject_Init()
#include "datetime.h"
#include "structmember.h" // PyMemberDef
@@ -2448,7 +2449,7 @@
goto Done
if (us) {
- y = accum("microseconds", x, us, _PyLong_One, &leftover_us);
+ y = accum("microseconds", x, us, _PyLong_GetOne(), &leftover_us);
CLEANUP;
}
if (ms) {
@@ -2487,7 +2488,7 @@
* is odd. Note that x is odd when it's last bit is 1. The
* code below uses bitwise and operation to check the last
* bit. */
- temp = PyNumber_And(x, _PyLong_One); /* temp <- x & 1 */
+ temp = PyNumber_And(x, _PyLong_GetOne()); /* temp <- x & 1 */
if (temp == NULL) {
Py_DECREF(x);
goto Done;