Skip to content

Commit b437894

Browse files
authored
gh-95105: Return Iterator from wsgiref.types.InputStream.__iter__ (#95106)
1 parent 936f71e commit b437894

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Lib/wsgiref/types.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""WSGI-related types for static type checking"""
22

3-
from collections.abc import Callable, Iterable
3+
from collections.abc import Callable, Iterable, Iterator
44
from types import TracebackType
55
from typing import Any, Protocol, TypeAlias
66

@@ -35,7 +35,7 @@ class InputStream(Protocol):
3535
def read(self, size: int = ..., /) -> bytes: ...
3636
def readline(self, size: int = ..., /) -> bytes: ...
3737
def readlines(self, hint: int = ..., /) -> list[bytes]: ...
38-
def __iter__(self) -> Iterable[bytes]: ...
38+
def __iter__(self) -> Iterator[bytes]: ...
3939

4040
class ErrorStream(Protocol):
4141
"""WSGI error stream as defined in PEP 3333"""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:meth:`wsgiref.types.InputStream.__iter__` should return ``Iterator[bytes]``, not ``Iterable[bytes]``. Patch by Shantanu Jain.

0 commit comments

Comments
 (0)