python / python/cpython

Add structured version info for decimal

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

Nobody has claimed this yet.

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

Description

Feature or enhancement

decimal.__libmpdec_version__ (from mpd_version()) is the only information about the libmpdec library, and it only describes the library loaded at runtime. The version of the library that the module was built against is not exposed, although it can differ now that only a system libmpdec is used.

libmpdec provides MPD_VERSION, MPD_MAJOR_VERSION, MPD_MINOR_VERSION and MPD_MICRO_VERSION at compile time, and mpd_version() at runtime.

Add decimal.LIBMPDEC_VERSION and decimal.LIBMPDEC_VERSION_INFO for the build-time version, decimal.libmpdec_version as an alias of __libmpdec_version__, and decimal.libmpdec_version_info for the runtime version.

These names are specific to the C implementation and are not added to _pydecimal; the test which checks that both implementations expose the same names has to exclude them.

Linked PRs
  • gh-157476

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 locating the C implementation of decimal and the _pydecimal implementation, then inspect the existing mpd_version() and libmpdec_version handling. Check the test that requires both implementations to expose the same names; done means the requested build-time and runtime names are exposed by the C implementation and the parity test excludes them.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.