mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +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
|
@ -374,9 +374,8 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
|
|||
|
||||
/* Convert step to an integer; raise for zero step. */
|
||||
if (self->step == Py_None) {
|
||||
step = PyLong_FromLong(1L);
|
||||
if (step == NULL)
|
||||
goto error;
|
||||
step = _PyLong_One;
|
||||
Py_INCREF(step);
|
||||
step_is_negative = 0;
|
||||
}
|
||||
else {
|
||||
|
@ -404,10 +403,8 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
|
|||
goto error;
|
||||
}
|
||||
else {
|
||||
lower = PyLong_FromLong(0L);
|
||||
if (lower == NULL)
|
||||
goto error;
|
||||
|
||||
lower = _PyLong_Zero;
|
||||
Py_INCREF(lower);
|
||||
upper = length;
|
||||
Py_INCREF(upper);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue