[New-bugs-announce] [issue29896] ElementTree.fromstring raises undocumented UnicodeError

Vasiliy Faronov report at bugs.python.org
Fri Mar 24 10:34:38 EDT 2017


New submission from Vasiliy Faronov:

>>> from xml.etree import ElementTree as ET
>>> ET.fromstring(b'<\xC4/>')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML
    parser.feed(text)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 0: invalid continuation byt
e

The documentation for xml.etree.ElementTree does not mention that it can raise UnicodeError, only ParseError.

I think that either the above error should be wrapped in a ParseError, or the documentation should be amended.

This happens at least on 3.6, 3.5 and 2.7.

----------
messages: 290091
nosy: vfaronov
priority: normal
severity: normal
status: open
title: ElementTree.fromstring raises undocumented UnicodeError
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

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


More information about the New-bugs-announce mailing list