diff --git a/stdlib/3/sys.pyi b/stdlib/3/sys.pyi index acfce135b2a4..9a8ce9d782f8 100644 --- a/stdlib/3/sys.pyi +++ b/stdlib/3/sys.pyi @@ -19,14 +19,16 @@ _ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] _OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]] # ----- sys variables ----- -abiflags: str +if sys.platform != "win32": + abiflags: str argv: List[str] base_exec_prefix: str base_prefix: str byteorder: str builtin_module_names: Sequence[str] # actually a tuple of strings copyright: str -# dllhandle = 0 # Windows only +if sys.platform == "win32": + dllhandle: int dont_write_bytecode: bool displayhook: Callable[[object], Any] excepthook: Callable[[Type[BaseException], BaseException, TracebackType], Any] @@ -64,7 +66,8 @@ api_version: int warnoptions: Any # Each entry is a tuple of the form (action, message, category, module, # lineno) -# winver = '' # Windows only +if sys.platform == "win32": + winver: str _xoptions: Dict[Any, Any] @@ -141,7 +144,6 @@ def exc_info() -> _OptExcInfo: ... def exit(__status: object = ...) -> NoReturn: ... def getdefaultencoding() -> str: ... if sys.platform != 'win32': - # Unix only def getdlopenflags() -> int: ... def getfilesystemencoding() -> str: ... def getrefcount(__object: Any) -> int: ... @@ -179,8 +181,8 @@ class _WinVersion(Tuple[int, int, int, int, product_type: int platform_version: Tuple[int, int, int] - -def getwindowsversion() -> _WinVersion: ... # Windows only +if sys.platform == "win32": + def getwindowsversion() -> _WinVersion: ... def intern(__string: str) -> str: ... @@ -190,7 +192,8 @@ if sys.version_info >= (3, 7): __breakpointhook__: Any # contains the original value of breakpointhook def breakpointhook(*args: Any, **kwargs: Any) -> Any: ... -def setdlopenflags(__flags: int) -> None: ... # Linux only +if sys.platform != "win32": + def setdlopenflags(__flags: int) -> None: ... def setrecursionlimit(__limit: int) -> None: ... def setswitchinterval(__interval: float) -> None: ... diff --git a/tests/stubtest_whitelists/linux.txt b/tests/stubtest_whitelists/linux.txt index c64df77a1102..a0b10df46a38 100644 --- a/tests/stubtest_whitelists/linux.txt +++ b/tests/stubtest_whitelists/linux.txt @@ -27,7 +27,6 @@ spwd.getspnam spwd.struct_spwd._asdict spwd.struct_spwd._make spwd.struct_spwd._replace -sys.getwindowsversion time.CLOCK_HIGHRES urllib.request.proxy_bypass diff --git a/tests/stubtest_whitelists/win32.txt b/tests/stubtest_whitelists/win32.txt index 9e22d0b04bd3..cc0e88fb2870 100644 --- a/tests/stubtest_whitelists/win32.txt +++ b/tests/stubtest_whitelists/win32.txt @@ -4,8 +4,6 @@ locale.nl_langinfo # Function that should be moved to _locale and re-exported c os.path.join # Parameter name mismatch posixpath.altsep # Type mismatch posixpath.realpath # Parameter name mismatch -sys.abiflags # Not present -sys.setdlopenflags # Not present urllib.request.pathname2url # Parameter name mismatch urllib.request.url2pathname # Same