diff --git a/.github/workflows/stubtest.yml b/.github/workflows/stubtest.yml index 714039c24..3b9f7d493 100644 --- a/.github/workflows/stubtest.yml +++ b/.github/workflows/stubtest.yml @@ -23,7 +23,7 @@ jobs: os: ["ubuntu-latest", "windows-latest", "macos-10.15"] # Python 3.9 and 3.10 temporarily pinned due to incompatibilities # between micro versions. - python-version: ["3.6", "3.7", "3.8", "3.9.9", "3.10.1"] + python-version: ["3.6", "3.7", "3.8", "3.9.10", "3.10.2"] fail-fast: false steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d651e6ce1..21faf6365 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -98,7 +98,7 @@ jobs: os: ["ubuntu-latest", "windows-latest", "macos-10.15"] # Python 3.9 and 3.10 temporarily pinned due to incompatibilities # between micro versions. - python-version: ["3.6", "3.7", "3.8", "3.9.9", "3.10.1"] + python-version: ["3.6", "3.7", "3.8", "3.9.10", "3.10.2"] fail-fast: false steps: diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 766f25226..48c4b9d98 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -89,12 +89,25 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod async def shutdown_asyncgens(self) -> None: ... # Methods scheduling callbacks. All these return Handles. - @abstractmethod - def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ... - @abstractmethod - def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... - @abstractmethod - def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... + if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2 + @abstractmethod + def call_soon(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ... + @abstractmethod + def call_later( + self, delay: float, callback: Callable[..., Any], *args: Any, context: Context | None = ... + ) -> TimerHandle: ... + @abstractmethod + def call_at( + self, when: float, callback: Callable[..., Any], *args: Any, context: Context | None = ... + ) -> TimerHandle: ... + else: + @abstractmethod + def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ... + @abstractmethod + def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... + @abstractmethod + def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ... + @abstractmethod def time(self) -> float: ... # Future methods @@ -115,8 +128,13 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod def get_task_factory(self) -> Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None: ... # Methods for interacting with threads - @abstractmethod - def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... + if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2 + @abstractmethod + def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ... + else: + @abstractmethod + def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... + @abstractmethod def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ... @abstractmethod diff --git a/stdlib/signal.pyi b/stdlib/signal.pyi index 0b3dcb756..f1495c92e 100644 --- a/stdlib/signal.pyi +++ b/stdlib/signal.pyi @@ -64,8 +64,14 @@ _SIGNUM = Union[int, Signals] _HANDLER = Union[Callable[[int, Optional[FrameType]], Any], int, Handlers, None] def default_int_handler(signum: int, frame: FrameType | None) -> None: ... -def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ... -def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ... + +if sys.version_info >= (3, 10): # arguments changed in 3.10.2 + def getsignal(signalnum: _SIGNUM) -> _HANDLER: ... + def signal(signalnum: _SIGNUM, handler: _HANDLER) -> _HANDLER: ... + +else: + def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ... + def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ... SIGABRT: Signals SIGEMT: Signals @@ -122,11 +128,18 @@ else: def getitimer(__which: int) -> tuple[float, float]: ... def pause() -> None: ... def pthread_kill(__thread_id: int, __signalnum: int) -> None: ... - def pthread_sigmask(__how: int, __mask: Iterable[int]) -> set[_SIGNUM]: ... + if sys.version_info >= (3, 10): # arguments changed in 3.10.2 + def pthread_sigmask(how: int, mask: Iterable[int]) -> set[_SIGNUM]: ... + else: + def pthread_sigmask(__how: int, __mask: Iterable[int]) -> set[_SIGNUM]: ... + def setitimer(__which: int, __seconds: float, __interval: float = ...) -> tuple[float, float]: ... def siginterrupt(__signalnum: int, __flag: bool) -> None: ... def sigpending() -> Any: ... - def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ... + if sys.version_info >= (3, 10): # argument changed in 3.10.2 + def sigwait(sigset: Iterable[int]) -> _SIGNUM: ... + else: + def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ... if sys.platform != "darwin": SIGCLD: Signals SIGPOLL: Signals