gh-95105: Return Iterator from wsgiref.types.InputStream.__iter__ (GH-95106)

(cherry picked from commit b4378948a0)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-07-21 13:52:11 -07:00 committed by GitHub
parent 120f226889
commit deacc3c9a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -1,6 +1,6 @@
"""WSGI-related types for static type checking"""
from collections.abc import Callable, Iterable
from collections.abc import Callable, Iterable, Iterator
from types import TracebackType
from typing import Any, Protocol, TypeAlias
@ -35,7 +35,7 @@ class InputStream(Protocol):
def read(self, size: int = ..., /) -> bytes: ...
def readline(self, size: int = ..., /) -> bytes: ...
def readlines(self, hint: int = ..., /) -> list[bytes]: ...
def __iter__(self) -> Iterable[bytes]: ...
def __iter__(self) -> Iterator[bytes]: ...
class ErrorStream(Protocol):
"""WSGI error stream as defined in PEP 3333"""

View file

@ -0,0 +1 @@
:meth:`wsgiref.types.InputStream.__iter__` should return ``Iterator[bytes]``, not ``Iterable[bytes]``. Patch by Shantanu Jain.