GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Try to avoid invoking a new process to determine the Windows version in the platform module · Issue #129294 · python/cpython Closed as not planned Closed as not planned Copy link Labels OS-windowsperformancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementProposal: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 Linked PRsReacted by garoto Activity
MetadataMetadataAssigneesLabelsOS-windowsperformancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |