From 48c8939ce68d3a04521ead2ae1f0e81a29b9393e Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Mon, 31 Aug 2020 13:04:49 -0700 Subject: [PATCH] concurrent.futures: update for py39, minor fixes (#4503) Note the new parameter doesn't actually exist on the base class, even though it's documented as that being the case. Asked about it in https://bugs.python.org/issue39349 Co-authored-by: hauntsaninja <> --- stdlib/3/concurrent/futures/_base.pyi | 12 +++++++++--- third_party/2/concurrent/futures/_base.pyi | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 97267a577..149bc3503 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -46,14 +46,20 @@ class Future(Generic[_T]): def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ... class Executor: - def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + if sys.version_info >= (3, 9): + def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + else: + def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... if sys.version_info >= (3, 5): def map( - self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... + self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... ) -> Iterator[_T]: ... else: def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ... - def shutdown(self, wait: bool = ...) -> None: ... + if sys.version_info >= (3, 9): + def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ... + else: + def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: _T) -> _T: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ... diff --git a/third_party/2/concurrent/futures/_base.pyi b/third_party/2/concurrent/futures/_base.pyi index 97267a577..149bc3503 100644 --- a/third_party/2/concurrent/futures/_base.pyi +++ b/third_party/2/concurrent/futures/_base.pyi @@ -46,14 +46,20 @@ class Future(Generic[_T]): def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ... class Executor: - def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + if sys.version_info >= (3, 9): + def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + else: + def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... if sys.version_info >= (3, 5): def map( - self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... + self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... ) -> Iterator[_T]: ... else: def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ... - def shutdown(self, wait: bool = ...) -> None: ... + if sys.version_info >= (3, 9): + def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ... + else: + def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: _T) -> _T: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...