bpo-42161: Use _PyLong_GetZero() and _PyLong_GetOne() (GH-22995)

Use _PyLong_GetZero() and _PyLong_GetOne()
in Objects/ and Python/ directories.
This commit is contained in:
Victor Stinner 2020-10-27 02:24:34 +01:00 committed by GitHub
parent 303aac8c56
commit c9bc290dd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 68 additions and 40 deletions

View file

@ -15,6 +15,7 @@ this type and there is exactly one in existence.
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "structmember.h" // PyMemberDef
@ -388,7 +389,7 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
/* Convert step to an integer; raise for zero step. */
if (self->step == Py_None) {
step = _PyLong_One;
step = _PyLong_GetOne();
Py_INCREF(step);
step_is_negative = 0;
}
@ -417,7 +418,7 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
goto error;
}
else {
lower = _PyLong_Zero;
lower = _PyLong_GetZero();
Py_INCREF(lower);
upper = length;
Py_INCREF(upper);