From 7cf1fed75d091fd7c864cd034d37bb2a8fc4cdaf Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Fri, 29 Sep 2023 22:38:14 +0300 Subject: [PATCH] Fix `sigtimedwait` and `sigwaitinfo` signature (#10803) --- stdlib/signal.pyi | 8 ++++++-- tests/stubtest_allowlists/linux-py310.txt | 2 -- tests/stubtest_allowlists/linux-py311.txt | 2 -- tests/stubtest_allowlists/linux-py312.txt | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/stdlib/signal.pyi b/stdlib/signal.pyi index 4c961a0c9..72c78f1b6 100644 --- a/stdlib/signal.pyi +++ b/stdlib/signal.pyi @@ -170,8 +170,12 @@ else: @property def si_band(self) -> int: ... - def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ... - def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ... + if sys.version_info >= (3, 10): + def sigtimedwait(__sigset: Iterable[int], __timeout: float) -> struct_siginfo | None: ... + def sigwaitinfo(__sigset: Iterable[int]) -> struct_siginfo: ... + else: + def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ... + def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ... if sys.version_info >= (3, 8): def strsignal(__signalnum: _SIGNUM) -> str | None: ... diff --git a/tests/stubtest_allowlists/linux-py310.txt b/tests/stubtest_allowlists/linux-py310.txt index 1e973da0b..c54fb6e07 100644 --- a/tests/stubtest_allowlists/linux-py310.txt +++ b/tests/stubtest_allowlists/linux-py310.txt @@ -1,6 +1,4 @@ _?curses.color_pair -signal.sigtimedwait -signal.sigwaitinfo # ========== # Allowlist entries that cannot or should not be fixed diff --git a/tests/stubtest_allowlists/linux-py311.txt b/tests/stubtest_allowlists/linux-py311.txt index 639f3c1db..197a5ff3e 100644 --- a/tests/stubtest_allowlists/linux-py311.txt +++ b/tests/stubtest_allowlists/linux-py311.txt @@ -1,3 +1 @@ _?curses.color_pair -signal.sigtimedwait -signal.sigwaitinfo diff --git a/tests/stubtest_allowlists/linux-py312.txt b/tests/stubtest_allowlists/linux-py312.txt index 3d07e183f..f81ce1b08 100644 --- a/tests/stubtest_allowlists/linux-py312.txt +++ b/tests/stubtest_allowlists/linux-py312.txt @@ -1,7 +1,5 @@ _?curses.color_pair _posixsubprocess.fork_exec -signal.sigtimedwait -signal.sigwaitinfo # Exists on some Linux builds, and is documented, # but is unavailable in Github Actions on Linux with Python 3.12