mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-39453: Make list.__contains__ hold strong references to avoid crashes (GH-18181)
This commit is contained in:
parent
a46575a8f2
commit
4dbf2d8c67
3 changed files with 13 additions and 1 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue