summaryrefslogtreecommitdiff
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-12 09:43:55 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-12 09:43:55 +0300
commit26decf7ca2281c57fcb6f286365a6929d283a975 (patch)
treec9046d4ea78cc6f52675d0b44613a0194ac9d6fc /Lib/test/test_xml_etree.py
parent657ccfb66a6830b2f54743c60fd11bb210905f06 (diff)
downloadcpython-26decf7ca2281c57fcb6f286365a6929d283a975.tar.gz
Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag.
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 44e3142dc9..bc1dd1461b 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):