]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-43284: Update platform.win32_ver to use _syscmd_ver instead of sys.getwindowsvers...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 23 Apr 2021 18:09:20 +0000 (11:09 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Apr 2021 18:09:20 +0000 (19:09 +0100)
commit52e9031fbd23c10668badc2a72ee5c203d6902c7
tree6eb7dea78539f430d18e84c87e2f7245a0bc70b7
parent04bcfe001cdf6290cb78fa4884002e5301e14c93
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.
(cherry picked from commit 2a3f4899c63806439e5bcea0c30f7e6a6295a763)

Co-authored-by: Shreyan Avigyan <shreyan.avigyan@gmail.com>
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]