summaryrefslogtreecommitdiff
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-10-27 17:12:53 +0100
committerGitHub <noreply@github.com>2020-10-27 17:12:53 +0100
commit37834136d0afe51d274bfc79d8705514cbe73727 (patch)
tree0e4c6b1f42813363f690e7ad179874d727d2cd79 /Modules/itertoolsmodule.c
parenta6879d9445f98833c4e300e187956e2a218a2315 (diff)
downloadcpython-git-37834136d0afe51d274bfc79d8705514cbe73727.tar.gz
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.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 3809dc3843..ce8b4347ef 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1,6 +1,7 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_tuple.h" // _PyTuple_ITEMS()
#include <stddef.h> // offsetof()
@@ -4040,13 +4041,14 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
}
} else {
cnt = 0;
- long_cnt = _PyLong_Zero;
+ long_cnt = _PyLong_GetZero();
}
Py_INCREF(long_cnt);
/* If not specified, step defaults to 1 */
- if (long_step == NULL)
- long_step = _PyLong_One;
+ if (long_step == NULL) {
+ long_step = _PyLong_GetOne();
+ }
Py_INCREF(long_step);
assert(long_cnt != NULL && long_step != NULL);