Skip to content

[3.14] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824)#152889

Merged
vstinner merged 1 commit into
python:3.14from
miss-islington:backport-4e4869b-3.14
Jul 2, 2026
Merged

[3.14] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824)#152889
vstinner merged 1 commit into
python:3.14from
miss-islington:backport-4e4869b-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Use WMI to detect virtualization on Windows.

Replace wmic command with _wmi module to get the operating system caption and
version.

The wmic tool is deprecated since January 2024:
https://techcommunity.microsoft.com/blog/windows-itpro-blog/wmi-command-line-wmic-utility-deprecation-next-steps/4039242

For example, it's no longer installed in Windows images on GitHub
Action.

Fix also run_command(): no longer try to spawn a subprocess if the
platform doesn't support subprocess. It avoids logging run_command()
errors.
(cherry picked from commit 4e4869b)

Co-authored-by: Victor Stinner vstinner@python.org

…onGH-152824)

Use WMI to detect virtualization on Windows.

Replace wmic command with _wmi module to get the operating system caption and
version.

The wmic tool is deprecated since January 2024:
https://techcommunity.microsoft.com/blog/windows-itpro-blog/wmi-command-line-wmic-utility-deprecation-next-steps/4039242

For example, it's no longer installed in Windows images on GitHub
Action.

Fix also run_command(): no longer try to spawn a subprocess if the
platform doesn't support subprocess. It avoids logging run_command()
errors.
(cherry picked from commit 4e4869b)

Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner vstinner enabled auto-merge (squash) July 2, 2026 13:12
@vstinner vstinner merged commit 4324eb2 into python:3.14 Jul 2, 2026
49 checks passed
@miss-islington miss-islington deleted the backport-4e4869b-3.14 branch July 2, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants