]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-43284: Update platform.win32_ver to use _syscmd_ver instead of sys.getwindowsvers...
authorShreyan Avigyan <shreyan.avigyan@gmail.com>
Thu, 22 Apr 2021 16:43:37 +0000 (22:13 +0530)
committerGitHub <noreply@github.com>
Thu, 22 Apr 2021 16:43:37 +0000 (17:43 +0100)
commit2a3f4899c63806439e5bcea0c30f7e6a6295a763
treec7f22925627748c1c5f71f0ea3f2948112512fac
parenta07da09ad5bd7d234ccd084a3a0933c290d1b592
bpo-43284: Update platform.win32_ver to use _syscmd_ver instead of sys.getwindowsversion() (GH-25500)

The sys module uses the kernel32.dll version number, which can vary from the "actual" Windows version.
Since the best option for getting the version is WMI (which is expensive), we switch back to launching cmd.exe (which is also expensive, but a lot less code on our part).
sys.getwindowsversion() is not updated to avoid launching executables from that module.
Doc/library/sys.rst
Lib/platform.py
Misc/NEWS.d/next/Library/2021-04-21-14-50-57.bpo-43284.2QZn2T.rst [new file with mode: 0644]