mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
#1316: remove redundant PyLong_Check calls when PyInt_Check was already called.
This commit is contained in:
parent
083bea49a8
commit
e1a0d11c5c
7 changed files with 24 additions and 31 deletions
|
|
@ -112,14 +112,14 @@ PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
|
|||
if (r->start == Py_None) {
|
||||
*start = *step < 0 ? length-1 : 0;
|
||||
} else {
|
||||
if (!PyInt_Check(r->start) && !PyLong_Check(r->step)) return -1;
|
||||
if (!PyInt_Check(r->start)) return -1;
|
||||
*start = PyInt_AsSsize_t(r->start);
|
||||
if (*start < 0) *start += length;
|
||||
}
|
||||
if (r->stop == Py_None) {
|
||||
*stop = *step < 0 ? -1 : length;
|
||||
} else {
|
||||
if (!PyInt_Check(r->stop) && !PyLong_Check(r->step)) return -1;
|
||||
if (!PyInt_Check(r->stop)) return -1;
|
||||
*stop = PyInt_AsSsize_t(r->stop);
|
||||
if (*stop < 0) *stop += length;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue