]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39453: Add testcase for bpo-39453 (GH-18202)
authorDong-hee Na <donghee.na92@gmail.com>
Mon, 27 Jan 2020 17:04:25 +0000 (02:04 +0900)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 27 Jan 2020 17:04:25 +0000 (09:04 -0800)
https://bugs.python.org/issue39453

Automerge-Triggered-By: @pablogsal
Automerge-Triggered-By: @pablogsal
Lib/test/test_list.py
Objects/listobject.c

index 33a55f76d9b2ccca4d18d66d6c632ea61f3e7399..3c8d82958fd7c88c00acbbb961f2bdad77b1483e 100644 (file)
@@ -225,6 +225,8 @@ class ListTest(list_tests.CommonTest):
         # to list elements while calling PyObject_RichCompareBool().
         lst = [X(), X()]
         3 in lst
+        lst = [X(), X()]
+        X() in lst
 
 
 if __name__ == "__main__":
index 38055d5f5f3410f759a0a723c5ae9f8f186182f8..2c07ceb0d412cef3c9267779c4b4c610501d7e55 100644 (file)
@@ -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;