mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +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
|
|
@ -3965,24 +3965,16 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
fast_mode = 0;
|
||||
}
|
||||
}
|
||||
Py_INCREF(long_cnt);
|
||||
} else {
|
||||
cnt = 0;
|
||||
long_cnt = PyLong_FromLong(0);
|
||||
if (long_cnt == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
long_cnt = _PyLong_Zero;
|
||||
}
|
||||
Py_INCREF(long_cnt);
|
||||
|
||||
/* If not specified, step defaults to 1 */
|
||||
if (long_step == NULL) {
|
||||
long_step = PyLong_FromLong(1);
|
||||
if (long_step == NULL) {
|
||||
Py_DECREF(long_cnt);
|
||||
return NULL;
|
||||
}
|
||||
} else
|
||||
Py_INCREF(long_step);
|
||||
if (long_step == NULL)
|
||||
long_step = _PyLong_One;
|
||||
Py_INCREF(long_step);
|
||||
|
||||
assert(long_cnt != NULL && long_step != NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue