diff options
-rw-r--r-- | Objects/listobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index bc8425c..a4e90db 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2584,6 +2584,10 @@ list_count(PyListObject *self, PyObject *value) for (i = 0; i < Py_SIZE(self); i++) { PyObject *obj = self->ob_item[i]; + if (obj == value) { + count++; + continue; + } Py_INCREF(obj); int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); Py_DECREF(obj); |