Skip to content

Fix Windows-specific allowlist entries in _msi, msilib, selectors and subprocess #10822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stdlib/_msi.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys

if sys.platform == "win32":
class MSIError(Exception): ...
# Actual typename View, not exposed by the implementation
class _View:
def Execute(self, params: _Record | None = ...) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/msilib/text.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import sys
if sys.platform == "win32":
ActionText: list[tuple[str, str, str | None]]
UIText: list[tuple[str, str | None]]

dirname: str
tables: list[str]
13 changes: 7 additions & 6 deletions stdlib/selectors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ class DevpollSelector(BaseSelector):
def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ...
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...

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

class DefaultSelector(BaseSelector):
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,7 @@ if sys.platform == "win32":
hStdError: Any | None
wShowWindow: int
lpAttributeList: Mapping[str, Any]
def copy(self) -> STARTUPINFO: ...
from _winapi import (
ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS,
BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS,
Expand Down
4 changes: 0 additions & 4 deletions tests/stubtest_allowlists/win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ locale.nl_langinfo # Function that should be moved to _locale and re-exported c
# alias for a class defined elsewhere,
# mypy infers the variable has type `(*args) -> DupHandle` but stubtest infers the runtime type as <class DupHandle>
multiprocessing.reduction.AbstractReducer.DupHandle
msilib.text.dirname
selectors.KqueueSelector

# Exists at runtime, but missing from stubs
_msi.MSIError
_winapi.CreateFileMapping
_winapi.MapViewOfFile
_winapi.OpenFileMapping
Expand All @@ -21,7 +18,6 @@ msvcrt.SetErrorMode
ssl.SSLSocket.recvmsg
ssl.SSLSocket.recvmsg_into
ssl.SSLSocket.sendmsg
subprocess.STARTUPINFO.copy
winreg.HKEYType.handle
_ctypes.FreeLibrary
_ctypes.LoadLibrary
Expand Down