diff options
author | Raymond Hettinger <python@rcn.com> | 2015-11-04 03:00:26 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-11-04 03:00:26 (GMT) |
commit | 4a91d2138199d28cd906997854cc4632f156bb05 (patch) | |
tree | f840568ebdd0472f32cbef6b99890a0d3cfc00a4 /Modules | |
parent | 9ce52e3bdac2b393c8de5b0da3b1a537dec1928c (diff) | |
download | cpython-4a91d2138199d28cd906997854cc4632f156bb05.zip cpython-4a91d2138199d28cd906997854cc4632f156bb05.tar.gz cpython-4a91d2138199d28cd906997854cc4632f156bb05.tar.bz2 |
Neaten-up the inner-loop logic.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_collectionsmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 1ca6c72..0e59470 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -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) { |