mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	gh-95105: Return Iterator from wsgiref.types.InputStream.__iter__ (#95106)
This commit is contained in:
		
							parent
							
								
									936f71e5d4
								
							
						
					
					
						commit
						b4378948a0
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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"""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
:meth:`wsgiref.types.InputStream.__iter__` should return ``Iterator[bytes]``, not ``Iterable[bytes]``. Patch by Shantanu Jain.
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue