python / python/cpython

pyexpat: xmlparser is actually XMLParserType

Open
#140,771 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.13 3.14 3.15 docs extension-modules topic-XML
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

The type of the Expat parser is referred everywhere as xmlparser, although no anchor for this reference is defined. But this type is actually exposed in the pyexpat (public API is xml.parsers.expat) module as XMLParserType since 2000 (4ba298c3253d5c4d11cf822619457701b7b248c0). The class name is xmlparser.

>>> import xml.parsers.expat
>>> xml.parsers.expat.__name__
'xml.parsers.expat'
>>> xml.parsers.expat.XMLParserType
<class 'pyexpat.xmlparser'>
>>> xml.parsers.expat.XMLParserType.__name__
'xmlparser'
>>> xml.parsers.expat.XMLParserType.__qualname__
'xmlparser'
>>> xml.parsers.expat.XMLParserType.__module__
'pyexpat'

I was planned to add an anchor for the xmlparser class, but since it is available as XMLParserType, should not we simply change its name and all references in the documentation to XMLParserType? Or add an alias xmlparser? (the question is why it was not used from the beginning.)

Linked PRs
  • gh-144456

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading this issue and the linked PR gh-144456, then determine whether the documentation should use XMLParserType or xmlparser. Done means the chosen public name has a defined anchor and the documentation references are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.