Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pep 7
  • Loading branch information
kristjanvalur committed Jan 7, 2024
commit 3b46fdb2ba4affbb1cde138682e9b0897368204c
8 changes: 5 additions & 3 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2689,13 +2689,15 @@ list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start,
PyObject *obj, *item = self->ob_item[i];
/* take reference to item, in case list modified by key or comparison */
Py_INCREF(item);
if (!key) {
if (key == NULL) {
obj = item;
} else {
}
else {
obj = PyObject_CallFunctionObjArgs(key, item, NULL);
Py_DECREF(item);
if (!obj)
if (obj == NULL) {
return NULL;
}
}
int cmp = PyObject_RichCompareBool(obj, value, Py_EQ);
Py_DECREF(obj);
Expand Down