Commit 4a91d213 authored by Raymond Hettinger's avatar Raymond Hettinger

Neaten-up the inner-loop logic.

parent 9ce52e3b
...@@ -1053,13 +1053,13 @@ deque_index(dequeobject *deque, PyObject *args) ...@@ -1053,13 +1053,13 @@ deque_index(dequeobject *deque, PyObject *args)
} }
} }
n = stop - i; n = stop - i + 1;
while (n--) { while (--n) {
CHECK_NOT_END(b); CHECK_NOT_END(b);
item = b->data[index]; item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ); cmp = PyObject_RichCompareBool(item, v, Py_EQ);
if (cmp > 0) if (cmp > 0)
return PyLong_FromSsize_t(stop - (n + 1)); return PyLong_FromSsize_t(stop - n);
if (cmp < 0) if (cmp < 0)
return NULL; return NULL;
if (start_state != deque->state) { if (start_state != deque->state) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment