[New-bugs-announce] [issue28871] Destructor of ElementTree.Element is recursive

Serhiy Storchaka report at bugs.python.org
Sun Dec 4 18:03:24 EST 2016


New submission from Serhiy Storchaka:

The Element class in the xml.etree.ElementTree module is a collection. It can contain other Element's. But unlike to common Python collections (list, dict, etc) and pure Python classes, C implementation of Element doesn't support unlimited recursion. As result, destroying very deep Element tree can cause stack overflow. Example:

import xml.etree.cElementTree as ElementTree
y = x = ElementTree.Element('x')
for i in range(200000): y = ElementTree.SubElement(y, 'x')

del x

----------
components: Extension Modules
messages: 282376
nosy: eli.bendersky, scoder, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Destructor of ElementTree.Element is recursive
type: crash
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28871>
_______________________________________


More information about the New-bugs-announce mailing list