From 84b582f405b2aedb74eff9adf31f8db98e3ce4cd Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sun, 30 Aug 2020 15:26:28 -0700 Subject: [PATCH 1/3] concurrent.futures: update for py39, mark positional-only args 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 --- stdlib/3/concurrent/futures/_base.pyi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 97267a57710d..897bd6bf365f 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -46,14 +46,17 @@ 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]: ... + 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]: ... From 2366b42e7146dc08306e86aad231c2e09029af0e Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sun, 30 Aug 2020 16:42:26 -0700 Subject: [PATCH 2/3] consistency --- third_party/2/concurrent/futures/_base.pyi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/third_party/2/concurrent/futures/_base.pyi b/third_party/2/concurrent/futures/_base.pyi index 97267a57710d..897bd6bf365f 100644 --- a/third_party/2/concurrent/futures/_base.pyi +++ b/third_party/2/concurrent/futures/_base.pyi @@ -46,14 +46,17 @@ 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]: ... + 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]: ... From 256519672fe5c34ac09b973057ff1555425d092d Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Mon, 31 Aug 2020 12:26:52 -0700 Subject: [PATCH 3/3] version gate positional only --- stdlib/3/concurrent/futures/_base.pyi | 5 ++++- third_party/2/concurrent/futures/_base.pyi | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 897bd6bf365f..149bc3503482 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -46,7 +46,10 @@ 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, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... diff --git a/third_party/2/concurrent/futures/_base.pyi b/third_party/2/concurrent/futures/_base.pyi index 897bd6bf365f..149bc3503482 100644 --- a/third_party/2/concurrent/futures/_base.pyi +++ b/third_party/2/concurrent/futures/_base.pyi @@ -46,7 +46,10 @@ 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, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...