]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824) (#152890)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 2 Jul 2026 13:27:35 +0000 (15:27 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Jul 2026 13:27:35 +0000 (13:27 +0000)
commita1a9e6f081256b88860b3866f2b19398eca57d99
tree7f0a6a536c754894734a612b5f4f50e3d5cb41dd
parent9317d52169d2d845a74a082e2df86ce3978832f3
[3.15] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824) (#152890)

gh-152680: Detect virtualization on Windows in pythoninfo (GH-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 4e4869b62fa91e26117b1d9136f60b58c9f505a5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/pythoninfo.py