GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-76007: Deprecate `__version__` attribute in `decimal` by StanFromIreland · Pull Request #140302 · python/cpython

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Oct 18, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Per discussion in the issue, provide a SPEC_VERSION constant instead. CC @merwok @smontanaro

  • Issue: Misleading __version__ attribute of modules in standard library #76007

📚 Documentation preview 📚: https://cpython-previews--140302.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@StanFromIreland
Commit
8c30b2c
@StanFromIreland
StanFromIreland requested review from hugovk and rhettinger October 18, 2025 14:24
@StanFromIreland
StanFromIreland requested a review from AA-Turner as a code owner October 18, 2025 14:24
@bedevere-app bedevere-app Bot mentioned this pull request Oct 18, 2025
Misleading __version__ attribute of modules in standard library #76007
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Oct 18, 2025
@StanFromIreland
StanFromIreland marked this pull request as draft October 18, 2025 14:52
@bedevere-app bedevere-app Bot removed the awaiting review label Oct 18, 2025
StanFromIreland added 2 commits October 18, 2025 16:15
@StanFromIreland
Commit
d583f55
@StanFromIreland
Commit
61a43b9
@StanFromIreland
StanFromIreland marked this pull request as ready for review October 18, 2025 15:17
@bedevere-app bedevere-app Bot added the awaiting review label Oct 18, 2025
vstinner
vstinner reviewed Oct 18, 2025
View reviewed changes
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Oct 18, 2025

Copy link
Copy Markdown
Member

cc @skirpichev @picnixz

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland @vstinner
Correct version number
0a2a9fb
Co-authored-by: Victor Stinner <[email protected]>
skirpichev
skirpichev reviewed Oct 18, 2025
View reviewed changes
Comment thread Doc/library/decimal.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/_pydecimal.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/_pydecimal.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

efimov-mikhail
efimov-mikhail reviewed Oct 18, 2025
View reviewed changes
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/decimal.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@merwok

merwok commented Oct 19, 2025

Copy link
Copy Markdown
Member

(Please edit the commit message when merging so that we’re not tagged forever by pushes in clones! thanks 🙂)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland and others added 2 commits October 19, 2025 08:40
@StanFromIreland @skirpichev
Apply suggestions from code review
9b43d7f
Co-authored-by: Sergey B Kirpichev <[email protected]>
@StanFromIreland
Convert to macro
82ef916
@StanFromIreland

StanFromIreland commented Oct 19, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

(Please edit the commit message when merging so that we’re not tagged forever by pushes in clones! thanks 🙂)

Éric, all of my commits up to that point had the commit message "Commit"? I tagged you in the PR description, I don't think that should be a burden for longer than this PR is open? There is an "unsubscribe" button in the right sidebar.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev reviewed Oct 19, 2025
View reviewed changes
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
Add comment
16b7bc8
@skirpichev
skirpichev requested a review from vstinner October 19, 2025 08:53
skirpichev
skirpichev approved these changes Oct 19, 2025
View reviewed changes

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, modulo one nitpick about decimal.rst.

I'm not sure also about naming for the constant. But lets see what other people think.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/decimal.rst Outdated

.. versionadded:: 3.8.3

.. data:: SPEC_VERSION

@skirpichev skirpichev Oct 19, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think that this should be moved up before "The constants in this section are only relevant for the C module." sentence of the first paragraph. Which should be also rephrased, i.e. "Following constants in <...>". Clearly, spec version is relevant for both modules.

BTW, I'm not sure about naming. Maybe more verbose "DECIMAL_SPEC_VERSION"?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@StanFromIreland StanFromIreland Oct 19, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I'm not sure about naming. Maybe more verbose "DECIMAL_SPEC_VERSION"?

I have a similar sentiment, I simply used this since it was in the discussion.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Oct 19, 2025
@skirpichev

skirpichev commented Oct 19, 2025

Copy link
Copy Markdown
Member

all of my commits up to that point had the commit message "Commit"? I tagged you in the PR description

It seems core devs sometimes use PR descriptions for commit messages. So, it's rather a reminder for one, who will merge this pr.

StanFromIreland and merwok reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
Relocate constant in doc
56a75e0
skirpichev
skirpichev approved these changes Oct 19, 2025
View reviewed changes
efimov-mikhail
efimov-mikhail approved these changes Oct 19, 2025
View reviewed changes
@hugovk
Merge branch 'main' into decimal-version
dbebb28
hugovk
hugovk approved these changes Oct 20, 2025
View reviewed changes

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure also about naming for the constant. But lets see what other people think.

decimal.SPEC_VERSION is fine by me. Skip also suggested it at #76007 (comment).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Doc/deprecations/pending-removal-in-3.20.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/whatsnew/3.15.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/_pydecimal.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 20, 2025
@StanFromIreland @hugovk
Apply suggestions from code review
ba3295b
Co-authored-by: Hugo van Kemenade <[email protected]>
@vstinner
vstinner merged commit 00026d1 into python:main Oct 26, 2025
4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 26, 2025
@vstinner

vstinner commented Oct 26, 2025

Copy link
Copy Markdown
Member

Merged, thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
StanFromIreland deleted the decimal-version branch October 26, 2025 11:06
@vstinner

vstinner commented Oct 28, 2025

Copy link
Copy Markdown
Member

Oh, importing decimal does now emit a DeprecationWarning:

$ ./python -Werror -c "import decimal"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import decimal
  File "/home/vstinner/python/main/Lib/decimal.py", line 103, in <module>
    from _decimal import __version__  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DeprecationWarning: '__version__' is deprecated and slated for removal in Python 3.20
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Oct 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Oh, ignore my previous comment, I forgot to run make when testing an old PR :-)

StanFromIreland reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@StanFromIreland @vstinner
@skirpichev @hugovk
pythongh-76007: Deprecate __version__ attribute in decimal (pytho…
2556dd9
…n#140302)

Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk hugovk approved these changes
@skirpichev skirpichev skirpichev approved these changes
@efimov-mikhail efimov-mikhail efimov-mikhail approved these changes
@rhettinger rhettinger Awaiting requested review from rhettinger
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@StanFromIreland @vstinner @merwok @skirpichev @hugovk @efimov-mikhail
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.