diff options
Diffstat (limited to 'Lib/test/test_list.py')
-rw-r--r-- | Lib/test/test_list.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index ece4598e4e..553ac8c1ce 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -162,6 +162,31 @@ class ListTest(list_tests.CommonTest): with self.assertRaises(TypeError): (3,) + L([1,2]) + def test_equal_operator_modifying_operand(self): + # test fix for seg fault reported in bpo-38588 part 2. + class X: + def __eq__(self,other) : + list2.clear() + return NotImplemented + + class Y: + def __eq__(self, other): + list1.clear() + return NotImplemented + + class Z: + def __eq__(self, other): + list3.clear() + return NotImplemented + + list1 = [X()] + list2 = [Y()] + self.assertTrue(list1 == list2) + + list3 = [Z()] + list4 = [1] + self.assertFalse(list3 == list4) + def test_count_index_remove_crashes(self): # bpo-38610: The count(), index(), and remove() methods were not # holding strong references to list elements while calling |