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

@ -1,6 +1,7 @@
/* enumerate object */
#include "Python.h"
#include "pycore_long.h" // _PyLong_GetOne()
#include "clinic/enumobject.c.h"
@ -115,7 +116,7 @@ enum_next_long(enumobject *en, PyObject* next_item)
}
next_index = en->en_longindex;
assert(next_index != NULL);
stepped_up = PyNumber_Add(next_index, _PyLong_One);
stepped_up = PyNumber_Add(next_index, _PyLong_GetOne());
if (stepped_up == NULL) {
Py_DECREF(next_item);
return NULL;