diff --git a/stdlib/3/asyncio/futures.pyi b/stdlib/3/asyncio/futures.pyi index 768bfee01..a4f8d6710 100644 --- a/stdlib/3/asyncio/futures.pyi +++ b/stdlib/3/asyncio/futures.pyi @@ -46,7 +46,10 @@ class Future(Awaitable[_T], Iterable[_T]): @property def _callbacks(self: _S) -> List[Callable[[_S], Any]]: ... def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ... - def cancel(self) -> bool: ... + if sys.version_info >= (3, 9): + def cancel(self, msg: Optional[str] = ...) -> bool: ... + else: + def cancel(self) -> bool: ... def cancelled(self) -> bool: ... def done(self) -> bool: ... def result(self) -> _T: ... diff --git a/stdlib/3/asyncio/tasks.pyi b/stdlib/3/asyncio/tasks.pyi index a0a5f2253..f7de40db1 100644 --- a/stdlib/3/asyncio/tasks.pyi +++ b/stdlib/3/asyncio/tasks.pyi @@ -113,7 +113,10 @@ class Task(Future[_T], Generic[_T]): def set_name(self, __value: object) -> None: ... def get_stack(self, *, limit: int = ...) -> List[FrameType]: ... def print_stack(self, *, limit: int = ..., file: TextIO = ...) -> None: ... - def cancel(self) -> bool: ... + if sys.version_info >= (3, 9): + def cancel(self, msg: Optional[str] = ...) -> bool: ... + else: + def cancel(self) -> bool: ... if sys.version_info < (3, 7): def _wakeup(self, fut: Future[Any]) -> None: ... diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index 41ad9ada2..6d49e6151 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -16,18 +16,14 @@ ast.Str.__new__ asyncio.AbstractEventLoop.sock_sendfile asyncio.Future.__init__ asyncio.Future._callbacks -asyncio.Future.cancel asyncio.Handle.__init__ -asyncio.Task.cancel asyncio.TimerHandle.__init__ asyncio.events.AbstractEventLoop.sock_sendfile asyncio.events.Handle.__init__ asyncio.events.TimerHandle.__init__ asyncio.futures.Future.__init__ asyncio.futures.Future._callbacks -asyncio.futures.Future.cancel asyncio.proactor_events._ProactorBasePipeTransport.__del__ -asyncio.tasks.Task.cancel builtins.bytearray.extend builtins.bytearray.pop builtins.compile