diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-21 10:32:56 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-21 10:32:56 (GMT) |
commit | 18f018ca12fccecaefc427927350538d5d37d51e (patch) | |
tree | d65b77f4f8b56451bc9cb857c8b381ca2b234355 /Lib/test/test_xml_etree_c.py | |
parent | fb2ae15c6704a072afeef4786749d9bb2ce7d68d (diff) | |
download | cpython-18f018ca12fccecaefc427927350538d5d37d51e.zip cpython-18f018ca12fccecaefc427927350538d5d37d51e.tar.gz cpython-18f018ca12fccecaefc427927350538d5d37d51e.tar.bz2 |
Issue #28871: Fixed a crash when deallocate deep ElementTree.
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r-- | Lib/test/test_xml_etree_c.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 96b446e..bfced12 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -11,6 +11,7 @@ cET_alias = import_fresh_module('xml.etree.cElementTree', fresh=['_elementtree', 'xml.etree']) +@unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @support.bigmemtest(size=support._2G + 100, memuse=1, dry_run=False) @@ -54,6 +55,15 @@ class MiscTests(unittest.TestCase): del element.attrib self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) + def test_trashcan(self): + # If this test fails, it will most likely die via segfault. + e = root = cET.Element('root') + for i in range(200000): + e = cET.SubElement(e, 'x') + del e + del root + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): |