diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 6876e60e4..3b92843fa 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -16,7 +16,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 diff --git a/stdlib/@tests/stubtest_allowlists/darwin.txt b/stdlib/@tests/stubtest_allowlists/darwin.txt index 4654ecb79..e02468b6b 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin.txt @@ -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_]+ diff --git a/stdlib/@tests/stubtest_allowlists/linux.txt b/stdlib/@tests/stubtest_allowlists/linux.txt index d82c0a7dc..8d7176ce3 100644 --- a/stdlib/@tests/stubtest_allowlists/linux.txt +++ b/stdlib/@tests/stubtest_allowlists/linux.txt @@ -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. diff --git a/stdlib/select.pyi b/stdlib/select.pyi index aad6d951f..42941b9e4 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -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, /