bpo-39453: Add testcase for bpo-39453 (GH-18202)

https://bugs.python.org/issue39453



Automerge-Triggered-By: @pablogsal

Automerge-Triggered-By: @pablogsal
This commit is contained in:
Dong-hee Na 2020-01-28 02:04:25 +09:00 committed by Miss Islington (bot)
parent 7023288dc5
commit 9e1ed518a5
2 changed files with 3 additions and 1 deletions

View File

@ -225,6 +225,8 @@ class ListTest(list_tests.CommonTest):
# to list elements while calling PyObject_RichCompareBool(). # to list elements while calling PyObject_RichCompareBool().
lst = [X(), X()] lst = [X(), X()]
3 in lst 3 in lst
lst = [X(), X()]
X() in lst
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -452,7 +452,7 @@ list_contains(PyListObject *a, PyObject *el)
for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i) { for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i) {
item = PyList_GET_ITEM(a, i); item = PyList_GET_ITEM(a, i);
Py_INCREF(item); Py_INCREF(item);
cmp = PyObject_RichCompareBool(PyList_GET_ITEM(a, i), el, Py_EQ); cmp = PyObject_RichCompareBool(item, el, Py_EQ);
Py_DECREF(item); Py_DECREF(item);
} }
return cmp; return cmp;