mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-40280: Use presence of msvcrt module to detect Windows (GH-30930)
This commit is contained in:
parent
897ce90187
commit
606e496dd6
2 changed files with 9 additions and 4 deletions
|
@ -65,10 +65,15 @@ __all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "getstatusoutput",
|
|||
# NOTE: We intentionally exclude list2cmdline as it is
|
||||
# considered an internal implementation detail. issue10838.
|
||||
|
||||
_mswindows = sys.platform == "win32"
|
||||
# use presence of msvcrt to detect Windows-like platforms (see bpo-8110)
|
||||
try:
|
||||
import msvcrt
|
||||
except ModuleNotFoundError:
|
||||
_mswindows = False
|
||||
else:
|
||||
_mswindows = True
|
||||
|
||||
if _mswindows:
|
||||
import msvcrt
|
||||
import _winapi
|
||||
from _winapi import (CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP,
|
||||
STD_INPUT_HANDLE, STD_OUTPUT_HANDLE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue