tiran/defusedxml

The html argument of XMLParser() is deprecated in python3.7

d1p opened this issue · 4 comments

d1p commented

I think the title says all, however here is the actual warning message.

/Users/debashisdip/.local/share/virtualenvs/EA_SA_805-YTDxf4Xg/lib/python3.7/site-packages/defusedxml/ElementTree.py:68: DeprecationWarning: The html argument of XMLParser() is deprecated
  _XMLParser.__init__(self, html, target, encoding)

See #24 which fixes this issue.

Perhaps it's time for a micro release?
Esp. now that 3.8 is on the horizon :)

I don't know why this bug is closed. The 'master' branch still uses the deprecated 'html' argument. In Python 3.8.0a2 you can no longer use the XMLParser class:

  File "/usr/local/python-3.8.0a/lib/python3.8/site-packages/defusedxml/common.py", line 113, in fromstring
    parser = DefusedXMLParser(target=_TreeBuilder(),
  File "/usr/local/python-3.8.0a/lib/python3.8/site-packages/defusedxml/ElementTree.py", line 68, in __init__
    _XMLParser.__init__(self, html, target, encoding)
TypeError: __init__() takes 1 positional argument but 4 were given

I think the fix is trivial, change the call to:

_XMLParser.__init__(self, target=target, encoding=encoding)

I think it is closed because there is PR #24 which fixes this issue. It only has to be merged.