bpo-39425: Fix list.count performance regression (GH-18119)
https://bugs.python.org/issue39425 Automerge-Triggered-By: @pablogsal
This commit is contained in:
parent
5bbac8cbdf
commit
14d80d0b60
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue