Skip to content

TypeError when RustPython parses XML string  #4983

Open
@xiaxinmeng

Description

@xiaxinmeng

Summary

In Python, the xml.sax.parseString() is used to parse an XML string and generate SAX events. RustPython reports a TypeError when using this function.

Example.py:

import xml.sax

class MyHandler(xml.sax.handler.ContentHandler):
	pass

data = "<main></main>"

xml.sax.parseString(data, MyHandler())

Expected

works normally on CPython 3.9.0

Actual

Reports a TypeError on RustPython:

Traceback (most recent call last):
  File "/home/xxm/Desktop/RustPython/example.py", line 198, in <module>
    xml.sax.parseString(data, MyHandler())
  File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/59df92d/pylib/Lib/xml/sax/__init__.py", line 48, in parseString
    parser.parse(inpsrc)
  File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/59df92d/pylib/Lib/xml/sax/expatreader.py", line 117, in parse
    raise
  File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/59df92d/pylib/Lib/xml/sax/expatreader.py", line 109, in parse
    self.reset()
  File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/59df92d/pylib/Lib/xml/sax/expatreader.py", line 285, in reset
    intern = self._interning)
TypeError: Expected type 'str' but 'NoneType' found

Environment

RustPython: v0.2.0 (https://github.com/RustPython/RustPython#59df92d7)
CPython: 3.9.0
Ubuntu 18.04

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