[issue29050] xml.etree.ElementTree in Python 3.6 is incompatible with defusedxml

Adam Williamson report at bugs.python.org
Thu Dec 22 15:13:35 EST 2016


Adam Williamson added the comment:

Aha, so thanks to my colleague Patrick Uiterwijk, we see the problem. Since Python 3.3, Python doesn't actually use that pure-Python iterparse() function if it can instead replace it with a C version:

https://github.com/python/cpython/blob/3.3/Lib/xml/etree/ElementTree.py#L1705

"# Overwrite 'ElementTree.parse' and 'iterparse' to use the C XMLParser"

so the reason defusedxml wants to use _IterParseIterator on Python 3 is because if it just uses xml.etree.ElementTree.iterparse() it's getting the 'accelerated' C implementation, not the pure-Python implementation it wants.

----------

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


More information about the Python-bugs-list mailing list