Skip to content

Commit 54d825a

Browse files
authored
Fix Windows-specific allowlist entries in _msi, msilib, selectors and subprocess (#10822)
1 parent 07e611d commit 54d825a

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

stdlib/_msi.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22

33
if sys.platform == "win32":
4+
class MSIError(Exception): ...
45
# Actual typename View, not exposed by the implementation
56
class _View:
67
def Execute(self, params: _Record | None = ...) -> None: ...

stdlib/msilib/text.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import sys
33
if sys.platform == "win32":
44
ActionText: list[tuple[str, str, str | None]]
55
UIText: list[tuple[str, str | None]]
6-
6+
dirname: str
77
tables: list[str]

stdlib/selectors.pyi

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ class DevpollSelector(BaseSelector):
5959
def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ...
6060
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
6161

62-
class KqueueSelector(BaseSelector):
63-
def fileno(self) -> int: ...
64-
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ...
65-
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
66-
def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ...
67-
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
62+
if sys.platform != "win32":
63+
class KqueueSelector(BaseSelector):
64+
def fileno(self) -> int: ...
65+
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ...
66+
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
67+
def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ...
68+
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
6869

6970
# Not a real class at runtime, it is just a conditional alias to other real selectors.
7071
# The runtime logic is more fine-grained than a `sys.platform` check;

stdlib/subprocess.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,6 +2600,7 @@ if sys.platform == "win32":
26002600
hStdError: Any | None
26012601
wShowWindow: int
26022602
lpAttributeList: Mapping[str, Any]
2603+
def copy(self) -> STARTUPINFO: ...
26032604
from _winapi import (
26042605
ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS,
26052606
BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS,

tests/stubtest_allowlists/win32.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ locale.nl_langinfo # Function that should be moved to _locale and re-exported c
44
# alias for a class defined elsewhere,
55
# mypy infers the variable has type `(*args) -> DupHandle` but stubtest infers the runtime type as <class DupHandle>
66
multiprocessing.reduction.AbstractReducer.DupHandle
7-
msilib.text.dirname
8-
selectors.KqueueSelector
97

108
# Exists at runtime, but missing from stubs
11-
_msi.MSIError
129
_winapi.CreateFileMapping
1310
_winapi.MapViewOfFile
1411
_winapi.OpenFileMapping
@@ -21,7 +18,6 @@ msvcrt.SetErrorMode
2118
ssl.SSLSocket.recvmsg
2219
ssl.SSLSocket.recvmsg_into
2320
ssl.SSLSocket.sendmsg
24-
subprocess.STARTUPINFO.copy
2521
winreg.HKEYType.handle
2622
_ctypes.FreeLibrary
2723
_ctypes.LoadLibrary

0 commit comments

Comments
 (0)