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-81773: Avoid parsing sys.version string in sysconfig by vstinner · Pull Request #146149 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Mar 19, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

No longer parse sys.version string to create sysconfig._PY_VERSION. Add _sysconfig.PY_VERSION constant.

  • Issue: sysconfig should not rely on sys.version #81773

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-81773: Avoid parsing sys.version string in sysconfig
072673a
No longer parse sys.version string to create sysconfig._PY_VERSION.
Add _sysconfig._PY_VERSION constant.
@vstinner vstinner added the skip news label Mar 19, 2026
@vstinner
vstinner requested a review from FFY00 as a code owner March 19, 2026 00:53
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 19, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Mar 19, 2026
sysconfig should not rely on sys.version #81773
Closed
@vstinner

vstinner commented Mar 19, 2026

Copy link
Copy Markdown
Member Author

cc @FFY00

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner added 4 commits March 19, 2026 01:59
@vstinner
Rename to _sysconfig.PY_VERSION
a4c2664
@vstinner
Reuse _sysconfig.config_vars() to get the Python version
0111638
* Move also py_version_short and py_version_nodot to _sysconfig.
* Use _sysconfig.config_vars() on all platforms, no only Windows.
@vstinner
Test sysconfig.get_python_version()
e84a712
@vstinner
Coding style
5c5ac7e
vstinner
vstinner commented Mar 23, 2026
View reviewed changes
Comment thread Lib/sysconfig/__init__.py
Comment on lines -534 to -535
_CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT
_CONFIG_VARS['py_version_nodot'] = _PY_VERSION_SHORT_NO_DOT

@vstinner vstinner Mar 23, 2026

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.

I'm not sure if it's worth it to move py_version_short and py_version_nodot to _sysconfig, since they can be easily built in Python.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Mar 26, 2026

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.

I reverted py_version_short and py_version_nodot changes.

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner

vstinner commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

Ping @FFY00.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
Revert py_version_short and py_version_nodot
ba53637
@vstinner

vstinner commented Mar 26, 2026

Copy link
Copy Markdown
Member Author

I'm not longer sure that this change is worth it. _PY_VERSION = sys.version.split()[0] just works. I close my PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner closed this Mar 26, 2026
@vstinner
vstinner deleted the sysconfig_py_version branch March 26, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review skip news

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.

1 participant

@vstinner
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.