From: Raymond Hettinger Date: Thu, 24 Sep 2015 02:15:44 +0000 (-0700) Subject: Replace an unpredictable branch with a simple addition. X-Git-Tag: v3.6.0a1~1455 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b0d646b751e6e5bdb466c05ffd2824dd46c7d60;p=python Replace an unpredictable branch with a simple addition. --- diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index be6c90c6fe..8d753c3e29 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -852,10 +852,9 @@ deque_count(dequeobject *deque, PyObject *v) CHECK_NOT_END(b); item = b->data[index]; cmp = PyObject_RichCompareBool(item, v, Py_EQ); - if (cmp > 0) - count++; - else if (cmp < 0) + if (cmp < 0) return NULL; + count += cmp; if (start_state != deque->state) { PyErr_SetString(PyExc_RuntimeError,