summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-11-04 03:00:26 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-11-04 03:00:26 (GMT)
commit4a91d2138199d28cd906997854cc4632f156bb05 (patch)
treef840568ebdd0472f32cbef6b99890a0d3cfc00a4 /Modules
parent9ce52e3bdac2b393c8de5b0da3b1a537dec1928c (diff)
downloadcpython-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.c6
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) {