summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_list.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-01-27 15:02:23 (GMT)
committerPablo Galindo <Pablogsal@gmail.com>2020-01-27 15:02:23 (GMT)
commit4dbf2d8c6789a9b7299b142033073213604b8fdc (patch)
tree1390368a570c1d528c18df15bf74ec443451f04d /Lib/test/test_list.py
parenta46575a8f2ded8b49e26c25bb67192e1500e76ca (diff)
downloadcpython-4dbf2d8c6789a9b7299b142033073213604b8fdc.zip
cpython-4dbf2d8c6789a9b7299b142033073213604b8fdc.tar.gz
cpython-4dbf2d8c6789a9b7299b142033073213604b8fdc.tar.bz2
bpo-39453: Make list.__contains__ hold strong references to avoid crashes (GH-18181)
Diffstat (limited to 'Lib/test/test_list.py')
-rw-r--r--Lib/test/test_list.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 6e3c4c1..33a55f7 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -221,6 +221,11 @@ class ListTest(list_tests.CommonTest):
with self.assertRaises(ValueError):
lst.remove(lst)
+ # bpo-39453: list.__contains__ was not holding strong references
+ # to list elements while calling PyObject_RichCompareBool().
+ lst = [X(), X()]
+ 3 in lst
+
if __name__ == "__main__":
unittest.main()