summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-12 06:47:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-12 06:47:20 (GMT)
commitf0ee5ccd19ec9ad0fd6c98ebf128832c225565cd (patch)
tree6ed466bf5490987d53848f58e1c581a7b89b8c7f /Lib/test/test_xml_etree.py
parentcf2ad555113e4afc6f8cd5ac5235deef6a3fdf82 (diff)
parent9062c261a4f9268f4621548ec205c80411f75b6e (diff)
downloadcpython-f0ee5ccd19ec9ad0fd6c98ebf128832c225565cd.zip
cpython-f0ee5ccd19ec9ad0fd6c98ebf128832c225565cd.tar.gz
cpython-f0ee5ccd19ec9ad0fd6c98ebf128832c225565cd.tar.bz2
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 a56f158..6e54628 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.
#
@@ -1864,6 +1864,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):