summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index e5d5b25..89cedc9 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2186,9 +2186,7 @@ listindex(PyListObject *self, PyObject *args)
if (stop < 0)
stop = 0;
}
- else if (stop > self->ob_size)
- stop = self->ob_size;
- for (i = start; i < stop; i++) {
+ for (i = start; i < stop && i < self->ob_size; i++) {
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
if (cmp > 0)
return PyInt_FromLong((long)i);