]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-152680: Detect virtualization on Windows in pythoninfo (#152824)
authorVictor Stinner <vstinner@python.org>
Thu, 2 Jul 2026 13:00:51 +0000 (15:00 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Jul 2026 13:00:51 +0000 (15:00 +0200)
commit4e4869b62fa91e26117b1d9136f60b58c9f505a5
tree0d9a263cf678da739bf030801c5130461650d8b8
parent53ff1a28ccfa69925c3c452cfc003970640fa65b
gh-152680: Detect virtualization on Windows in pythoninfo (#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.
Lib/test/pythoninfo.py