Skip to content

etree.XML raises TypeError on valid XML #3430

@alexprengere

Description

@alexprengere

etree.XML does not look like it is working.

>>>>> import xml.etree.ElementTree as etree
>>>>> etree.XML("<root></root>")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.../RustPython/vm/pylib-crate/Lib/xml/etree/ElementTree.py", line 1319, in XML
    parser = XMLParser(target=TreeBuilder())
  File "/home/.../RustPython/vm/pylib-crate/Lib/xml/etree/ElementTree.py", line 1508, in __init__
    parser = expat.ParserCreate(encoding, "}")
TypeError: Expected type 'str', not 'NoneType'

This code runs fine on CPython and PyPy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions