Open
Description
Feature or enhancement
Proposal:
In Lib/platform.py, there's a code aimed to determine the Windows version python runs in.
for cmd in ('ver', 'command /c ver', 'cmd /c ver'):
try:
info = subprocess.check_output(cmd,
stdin=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
text=True,
encoding="locale",
shell=True)
As much as I understand, one shouldn't invoke whole new process just to question what OS version he runs at.
so just before invoking cmd.exe, we will try to question winapi directly.
# Load ntdll.dll and call RtlGetVersion
ntdll = ctypes.WinDLL("ntdll")
rtl_get_version = ntdll.RtlGetVersion
rtl_get_version(ctypes.byref(os_version))
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response