python / python/cpython

Add structured version info for pyexpat

Open
#157,473 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.16 extension-modules topic-XML type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

pyexpat.EXPAT_VERSION (from XML_ExpatVersion()) and pyexpat.version_info (from XML_ExpatVersionInfo()) describe the Expat library loaded at runtime: both functions are compiled into libexpat from its XML_MAJOR_VERSION, XML_MINOR_VERSION and XML_MICRO_VERSION macros. The same macros evaluated in pyexpat.c give the version of the headers the module was built against, which is what the #if XML_COMBINED_VERSION >= ... checks in the module depend on. The two can differ when a system libexpat is used. The build-time version is not exposed to Python; it can only be inferred from which parser methods exist.

Add pyexpat.VERSION_INFO for the build-time version, and make pyexpat.version_info a named tuple.

Linked PRs
  • gh-157474

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 in pyexpat.c, where the Expat version macros and runtime version APIs are exposed. Trace the existing VERSION_INFO and version_info definitions, then verify that the build-time version is exposed separately and that version_info has named-tuple behavior. Check the pyexpat API tests if available and confirm both versions are reported correctly when they differ.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.