Skip to content

etree.XML raises TypeError on valid XML #3430

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions