Skip to content
Permalink
Browse files

bpo-39425: Fix list.count performance regression (GH-18119)

  • Loading branch information
corona10 authored and miss-islington committed Jan 22, 2020
1 parent 5bbac8c commit 14d80d0b605d8b148e14458e4c1853a940071462
Showing with 4 additions and 0 deletions.
  1. +4 βˆ’0 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);

0 comments on commit 14d80d0

Please sign in to comment.
You can’t perform that action at this time.