diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-05-10 17:21:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <antoine@python.org> | 2019-05-10 17:21:10 (GMT) |
commit | 351c67416ba4451eb3928fa0b2e933c2f25df1a3 (patch) | |
tree | 5054fe93291fa93533ddd97622f329e96a31847e /Lib/test/test_ordered_dict.py | |
parent | a2fedd8c910cb5f5b9bd568d6fd44d63f8f5cfa5 (diff) | |
download | cpython-351c67416ba4451eb3928fa0b2e933c2f25df1a3.zip cpython-351c67416ba4451eb3928fa0b2e933c2f25df1a3.tar.gz cpython-351c67416ba4451eb3928fa0b2e933c2f25df1a3.tar.bz2 |
bpo-35983: skip trashcan for subclasses (GH-11841)
Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism.
Patch by Jeroen Demeyer.
Diffstat (limited to 'Lib/test/test_ordered_dict.py')
-rw-r--r-- | Lib/test/test_ordered_dict.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_ordered_dict.py b/Lib/test/test_ordered_dict.py index b1d7f86..148a9bd 100644 --- a/Lib/test/test_ordered_dict.py +++ b/Lib/test/test_ordered_dict.py @@ -459,7 +459,9 @@ class OrderedDictTests: self.assertEqual(list(MyOD(items).items()), items) def test_highly_nested(self): - # Issue 25395: crashes during garbage collection + # Issues 25395 and 35983: test that the trashcan mechanism works + # correctly for OrderedDict: deleting a highly nested OrderDict + # should not crash Python. OrderedDict = self.OrderedDict obj = None for _ in range(1000): @@ -468,7 +470,9 @@ class OrderedDictTests: support.gc_collect() def test_highly_nested_subclass(self): - # Issue 25395: crashes during garbage collection + # Issues 25395 and 35983: test that the trashcan mechanism works + # correctly for OrderedDict: deleting a highly nested OrderDict + # should not crash Python. OrderedDict = self.OrderedDict deleted = [] class MyOD(OrderedDict): |