Make (Async)GeneratorType type parameters consistent with (Async)Generator type parameters (#14789)

Currently `Generator` is generic over three type variables that have defaults, but `GeneratorType` is generic over three type variables that do not have defaults. It seems like it probably makes more sense for them to be consistent? The vast majority of real-world `Generator`s are instances of `GeneratorType`
This commit is contained in:
Alex Waygood
2025-09-27 08:48:19 -07:00
committed by GitHub
parent 19c851629e
commit c7d0fd95f3
2 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -577,7 +577,7 @@ class Awaitable(Protocol[_T_co]):
@abstractmethod
def __await__(self) -> Generator[Any, Any, _T_co]: ...
# Non-default variations to accommodate couroutines, and `AwaitableGenerator` having a 4th type parameter.
# Non-default variations to accommodate coroutines, and `AwaitableGenerator` having a 4th type parameter.
_SendT_nd_contra = TypeVar("_SendT_nd_contra", contravariant=True)
_ReturnT_nd_co = TypeVar("_ReturnT_nd_co", covariant=True)