diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-06-12 06:43:55 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-06-12 06:43:55 (GMT) |
commit | 9062c261a4f9268f4621548ec205c80411f75b6e (patch) | |
tree | e6f41d63259f2c1bfa3bac2ebbe3a13f20047d3b /Lib | |
parent | 3c317e76a2fe78896b546e08fa753075463e7d41 (diff) | |
download | cpython-9062c261a4f9268f4621548ec205c80411f75b6e.zip cpython-9062c261a4f9268f4621548ec205c80411f75b6e.tar.gz cpython-9062c261a4f9268f4621548ec205c80411f75b6e.tar.bz2 |
Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_xml_etree.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 44e3142..bc1dd14 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -18,7 +18,7 @@ import weakref from itertools import product from test import support -from test.support import TESTFN, findfile, import_fresh_module, gc_collect +from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr # pyET is the pure-Python implementation. # @@ -1860,6 +1860,12 @@ class BadElementTest(ElementTestCase, unittest.TestCase): e.extend([ET.Element('bar')]) self.assertRaises(ValueError, e.remove, X('baz')) + def test_recursive_repr(self): + # Issue #25455 + e = ET.Element('foo') + with swap_attr(e, 'tag', e): + with self.assertRaises(RuntimeError): + repr(e) # Should not crash class MutatingElementPath(str): def __new__(cls, elem, *args): |