diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-18 20:29:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 20:29:14 (GMT) |
commit | d2a75c67830d7c9f59e4e9b60f36974234c829ef (patch) | |
tree | 4e6f90c9c9904f52c089610f21b4151a33714716 /Lib/test/test_xml_etree_c.py | |
parent | 60875db2f67815d7d181c552bfac59e8c97619e3 (diff) | |
download | cpython-d2a75c67830d7c9f59e4e9b60f36974234c829ef.zip cpython-d2a75c67830d7c9f59e4e9b60f36974234c829ef.tar.gz cpython-d2a75c67830d7c9f59e4e9b60f36974234c829ef.tar.bz2 |
bpo-35502: Fix reference leaks in ElementTree.TreeBuilder. (GH-11170)
Diffstat (limited to 'Lib/test/test_xml_etree_c.py')
-rw-r--r-- | Lib/test/test_xml_etree_c.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index e87de60..2144d20 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -1,4 +1,5 @@ # xml.etree test for cElementTree +import io import struct from test import support from test.support import import_fresh_module @@ -133,6 +134,26 @@ class MiscTests(unittest.TestCase): self.assertEqual(len(elem), 1) self.assertEqual(elem[0].tag, 'child') + def test_iterparse_leaks(self): + # Test reference leaks in TreeBuilder (issue #35502). + # The test is written to be executed in the hunting reference leaks + # mode. + XML = '<a></a></b>' + parser = cET.iterparse(io.StringIO(XML)) + next(parser) + del parser + support.gc_collect() + + def test_xmlpullparser_leaks(self): + # Test reference leaks in TreeBuilder (issue #35502). + # The test is written to be executed in the hunting reference leaks + # mode. + XML = '<a></a></b>' + parser = cET.XMLPullParser() + parser.feed(XML) + del parser + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): |