Issue 31303: xml.etree.ElementTree fails to parse a document (regression) (original) (raw)

In Python 3.5.4 and 3.6.2, both on Windows and Linux, parsing a manifestly correct xml file like:

xml.etree.ElementTree.parse('bad_file.xml')

raises: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 1023: invalid continuation byte

Any other Python version I tried works fine, including 2.7.13, 3.5.2 ...

Simpler reproducer:

import xml.etree.ElementTree xml.etree.ElementTree.XML(b'') Traceback (most recent call last): File "", line 1, in File "/home/serhiy/py/cpython/Lib/xml/etree/ElementTree.py", line 1315, in XML parser.feed(text) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 1023: invalid continuation byte

Seems this is a regression in the Expat library.