Skip to content
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

select.poll is not available on windows #13243

Merged
merged 6 commits into from
Dec 28, 2024
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: 0 additions & 1 deletion stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ http.client.HTTPConnection.response_class # the actual type at runtime is abc.A
importlib.abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
importlib.abc.MetaPathFinder.find_spec # Not defined on the actual class, but expected to exist.
importlib.abc.PathEntryFinder.find_spec # Not defined on the actual class, but expected to exist.
select.poll # Depends on configuration
socketserver.BaseServer.fileno # implemented in derived classes
socketserver.BaseServer.get_request # implemented in derived classes
socketserver.BaseServer.server_bind # implemented in derived classes
Expand Down
1 change: 1 addition & 0 deletions stdlib/@tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ curses.has_key # stubtest gets confused because this is both a module and a fun
multiprocessing.popen_spawn_win32 # exists on Darwin but fails to import
readline.append_history_file # Only available if compiled with GNU readline, not editline
select.kqueue.__init__ # default C signature is wrong
select.poll # Actually a function; we have a class so it can be used as a type

# Some of these exist on non-windows, but they are useless and this is not intended
stat.FILE_ATTRIBUTE_[A-Z_]+
Expand Down
1 change: 1 addition & 0 deletions stdlib/@tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ curses.LINES # Initialized only after initscr call
curses.has_key # stubtest gets confused because this is both a module and a function in curses
fcntl.I_[A-Z0-9_]+ # Platform differences that cannot be captured by the type system
multiprocessing.popen_spawn_win32 # exists on Linux but fails to import
select.poll # Actually a function; we have a class so it can be used as a type

# These seem like they should be available on Linux, but they're not
# on GitHub Actions runners for some reason.
Expand Down
13 changes: 8 additions & 5 deletions stdlib/select.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ if sys.platform != "win32":
POLLWRBAND: int
POLLWRNORM: int

class poll:
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ...
def unregister(self, fd: FileDescriptorLike) -> None: ...
def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ...
# This is actually a function that returns an instance of a class.
# The class is not accessible directly, and also calls itself select.poll.
class poll:
# default value is select.POLLIN | select.POLLPRI | select.POLLOUT
def register(self, fd: FileDescriptorLike, eventmask: int = 7, /) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int, /) -> None: ...
def unregister(self, fd: FileDescriptorLike, /) -> None: ...
def poll(self, timeout: float | None = None, /) -> list[tuple[int, int]]: ...

def select(
rlist: Iterable[Any], wlist: Iterable[Any], xlist: Iterable[Any], timeout: float | None = None, /
Expand Down
Loading