summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-02-17 09:13:52 (GMT)
committerGitHub <noreply@github.com>2020-02-17 09:13:52 (GMT)
commitf64abd10563c25a94011f9e3335fd8a1cf47c205 (patch)
tree886cada356a4085a5e436d48f8f26fa01b1dc6c1 /Lib/test
parent988aeba94bf1dab81dd52fc7b02dca7a57ea8ba0 (diff)
downloadcpython-f64abd10563c25a94011f9e3335fd8a1cf47c205.zip
cpython-f64abd10563c25a94011f9e3335fd8a1cf47c205.tar.gz
cpython-f64abd10563c25a94011f9e3335fd8a1cf47c205.tar.bz2
[3.8] bpo-39453: Fix contains method of list to hold strong references (GH-18204)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_list.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index f4dcced..105ef65 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -216,6 +216,13 @@ 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
+ lst = [X(), X()]
+ X() in lst
+
if __name__ == "__main__":
unittest.main()