]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824) (#152889)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 2 Jul 2026 13:28:13 +0000 (15:28 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Jul 2026 13:28:13 +0000 (13:28 +0000)
commit4324eb2e17bb50f51ebf703a0be9511d47974920
tree9c2ac01898960ff25f9bbafdd3d1968af6431846
parent8b3b7644e9e8a1203c7b9091abd71918e8a59836
[3.14] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824) (#152889)

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