Skip to content

Commit 6d5af24

Browse files
committed
fix: narrow scope to Python 3.13+ only
Revert changes to <3.13 stubs to avoid breaking existing code that assigns as_completed() sync-iter results to Future/Task variables. The Coroutine type is correct at runtime but too breaking for older versions. Only 3.13+ gets the fix where _SyncAndAsyncIterator Protocol exists.
1 parent f7a9935 commit 6d5af24

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

stdlib/asyncio/tasks.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ if sys.version_info >= (3, 13):
9393
def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = None) -> _SyncAndAsyncIterator[_T]: ...
9494

9595
elif sys.version_info >= (3, 10):
96-
def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = None) -> Iterator[Coroutine[Any, Any, _T]]: ...
96+
def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = None) -> Iterator[Future[_T]]: ...
9797

9898
else:
9999
def as_completed(
100100
fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = None, timeout: float | None = None
101-
) -> Iterator[Coroutine[Any, Any, _T]]: ...
101+
) -> Iterator[Future[_T]]: ...
102102

103103
@overload
104104
def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = None) -> _FT: ... # type: ignore[overload-overlap]

0 commit comments

Comments
 (0)