Skip to content

gh-152433: Windows: _winapi.c implement GetVersion() UWP alternative#152694

Merged
zooba merged 1 commit into
python:mainfrom
thexai:uwp-getversion
Jul 20, 2026
Merged

gh-152433: Windows: _winapi.c implement GetVersion() UWP alternative#152694
zooba merged 1 commit into
python:mainfrom
thexai:uwp-getversion

Conversation

@thexai

@thexai thexai commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Windows: _winapi.c implement GetVersion() UWP alternative.

@chris-eibl chris-eibl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

I hardly think this will have any user on XBOX, though, and even on Desktop the main usage was for subprocess to check whether we're on Win9x

cpython/Lib/subprocess.py

Lines 1030 to 1033 in 23bba4c

if (_winapi.GetVersion() >= 0x80000000 or
os.path.basename(comspec).lower() == "command.com"):
# Win9x, or using command.com on NT. We need to
# use the w9xpopen intermediate program. For more

which has been ripped out a while ago. IOW, it is not used in the Python codebase itself anymore (but there might be users out there, even though starting with an underscore and GetVersion "lying" at you when running in compatibility / manifested mode).

@chris-eibl
chris-eibl requested a review from a team July 19, 2026 12:11
@zooba
zooba merged commit 85ab112 into python:main Jul 20, 2026
60 checks passed
@zooba

zooba commented Jul 20, 2026

Copy link
Copy Markdown
Member

GetVersion "lying" at you when running in compatibility / manifested mode

Well, other stuff that's typically directly linked to the version number also gets changed, so if you are trying to detect whether some API behaves a certain way by checking the version number, then you'll want the reported version number to match the compatibility shims that you're getting when you call the API. It's only a lie if your goal is to print the current version to a human, which is why the platform module is separate.

@thexai
thexai deleted the uwp-getversion branch July 20, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants