Skip to content

Commit 8a8a805

Browse files
authored
Fix aiterator() signature. (typeddjango#262)
Queryset.aiterator() was set up to by annotated as `async () -> Iterator` which implies the call semantics are ``` for obj in await queryset.aiterator(): ... ``` But what we actually want is ``` async for obj in queryset.aiterator(): ... ``` Updated signature to match Django
1 parent 79fd3f9 commit 8a8a805

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

django-stubs/db/models/query.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _BaseQuerySet(Generic[_T], Sized):
4242
def __and__(self, other: _BaseQuerySet[_T]) -> Self: ...
4343
def __or__(self, other: _BaseQuerySet[_T]) -> Self: ...
4444
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
45-
async def aiterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
45+
def aiterator(self, chunk_size: int = ...) -> AsyncIterator[_T]: ...
4646
def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
4747
async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
4848
def get(self, *args: Any, **kwargs: Any) -> _T: ...

0 commit comments

Comments
 (0)