Skip to content

Commit ca1e477

Browse files
authored
Fix type of concurrent.futures.wait for Python <= 3.8 (#11537)
Closes #11533.
1 parent cc2ef48 commit ca1e477

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

stdlib/concurrent/futures/_base.pyi

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import threading
33
from _typeshed import Unused
4-
from collections.abc import Callable, Iterable, Iterator
4+
from collections.abc import Callable, Collection, Iterable, Iterator
55
from logging import Logger
66
from types import TracebackType
77
from typing import Any, Generic, Literal, NamedTuple, Protocol, TypeVar
@@ -91,9 +91,15 @@ class DoneAndNotDoneFutures(NamedTuple, Generic[_T]):
9191
done: set[Future[_T]]
9292
not_done: set[Future[_T]]
9393

94-
def wait(
95-
fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED"
96-
) -> DoneAndNotDoneFutures[_T]: ...
94+
if sys.version_info >= (3, 9):
95+
def wait(
96+
fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED"
97+
) -> DoneAndNotDoneFutures[_T]: ...
98+
99+
else:
100+
def wait(
101+
fs: Collection[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED"
102+
) -> DoneAndNotDoneFutures[_T]: ...
97103

98104
class _Waiter:
99105
event: threading.Event

0 commit comments

Comments
 (0)