diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-07-21 20:52:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-21 20:52:11 (GMT) |
commit | deacc3c9a64801ec5ea497bf618b9de2cf32a86f (patch) | |
tree | 84a4e1d66d4f789c89b2b965237ed209dc3a67b2 | |
parent | 120f226889b3b89e0cb804baccd6e9e3af76a39a (diff) | |
download | cpython-deacc3c9a64801ec5ea497bf618b9de2cf32a86f.zip cpython-deacc3c9a64801ec5ea497bf618b9de2cf32a86f.tar.gz cpython-deacc3c9a64801ec5ea497bf618b9de2cf32a86f.tar.bz2 |
gh-95105: Return Iterator from wsgiref.types.InputStream.__iter__ (GH-95106)
(cherry picked from commit b4378948a066821ce5147940ce3c1a80bc018b3c)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
-rw-r--r-- | Lib/wsgiref/types.py | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-07-21-19-55-49.gh-issue-95105.BIX2Km.rst | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Lib/wsgiref/types.py b/Lib/wsgiref/types.py index 9e74a6c..ef0aead 100644 --- a/Lib/wsgiref/types.py +++ b/Lib/wsgiref/types.py @@ -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""" diff --git a/Misc/NEWS.d/next/Library/2022-07-21-19-55-49.gh-issue-95105.BIX2Km.rst b/Misc/NEWS.d/next/Library/2022-07-21-19-55-49.gh-issue-95105.BIX2Km.rst new file mode 100644 index 0000000..58af62b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-07-21-19-55-49.gh-issue-95105.BIX2Km.rst @@ -0,0 +1 @@ +:meth:`wsgiref.types.InputStream.__iter__` should return ``Iterator[bytes]``, not ``Iterable[bytes]``. Patch by Shantanu Jain. |