Neaten-up the inner-loop logic.

This commit is contained in:
Raymond Hettinger 2015-11-03 22:00:26 -05:00
parent 9ce52e3bda
commit 4a91d21381
1 changed files with 3 additions and 3 deletions

View File

@ -1053,13 +1053,13 @@ deque_index(dequeobject *deque, PyObject *args)
}
}
n = stop - i;
while (n--) {
n = stop - i + 1;
while (--n) {
CHECK_NOT_END(b);
item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ);
if (cmp > 0)
return PyLong_FromSsize_t(stop - (n + 1));
return PyLong_FromSsize_t(stop - n);
if (cmp < 0)
return NULL;
if (start_state != deque->state) {