mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-29878: Add global instances of int for 0 and 1. (#852)
This commit is contained in:
parent
e6911a44f6
commit
ba85d69a3e
18 changed files with 105 additions and 249 deletions
|
@ -100,7 +100,6 @@ enum_traverse(enumobject *en, visitproc visit, void *arg)
|
|||
static PyObject *
|
||||
enum_next_long(enumobject *en, PyObject* next_item)
|
||||
{
|
||||
static PyObject *one = NULL;
|
||||
PyObject *result = en->en_result;
|
||||
PyObject *next_index;
|
||||
PyObject *stepped_up;
|
||||
|
@ -110,14 +109,9 @@ enum_next_long(enumobject *en, PyObject* next_item)
|
|||
if (en->en_longindex == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (one == NULL) {
|
||||
one = PyLong_FromLong(1);
|
||||
if (one == NULL)
|
||||
return NULL;
|
||||
}
|
||||
next_index = en->en_longindex;
|
||||
assert(next_index != NULL);
|
||||
stepped_up = PyNumber_Add(next_index, one);
|
||||
stepped_up = PyNumber_Add(next_index, _PyLong_One);
|
||||
if (stepped_up == NULL)
|
||||
return NULL;
|
||||
en->en_longindex = stepped_up;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue