Skip to content

Commit

Permalink
bpo-39453: Add testcase for bpo-39453 (GH-18202)
Browse files Browse the repository at this point in the history
https://bugs.python.org/issue39453



Automerge-Triggered-By: @pablogsal

Automerge-Triggered-By: @pablogsal
  • Loading branch information
corona10 authored and miss-islington committed Jan 27, 2020
1 parent 7023288 commit 9e1ed51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Lib/test/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ def __eq__(self, other):
# to list elements while calling PyObject_RichCompareBool().
lst = [X(), X()]
3 in lst
lst = [X(), X()]
X() in lst


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ list_contains(PyListObject *a, PyObject *el)
for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i) {
item = PyList_GET_ITEM(a, i);
Py_INCREF(item);
cmp = PyObject_RichCompareBool(PyList_GET_ITEM(a, i), el, Py_EQ);
cmp = PyObject_RichCompareBool(item, el, Py_EQ);
Py_DECREF(item);
}
return cmp;
Expand Down

0 comments on commit 9e1ed51

Please sign in to comment.