mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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:
parent
303aac8c56
commit
c9bc290dd6
9 changed files with 68 additions and 40 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue