bpo-34229: Check start and stop of slice object to be long when they are not int in PySlice_GetIndices (GH-8480)
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index c66e057..9daeafc 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -113,14 +113,14 @@
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) && !PyLong_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) && !PyLong_Check(r->stop)) return -1;
*stop = PyInt_AsSsize_t(r->stop);
if (*stop < 0) *stop += length;
}