@@ -402,8 +402,8 @@ class Reversible(Iterable[_T_co], Protocol[_T_co]):
402402 def __reversed__ (self ) -> Iterator [_T_co ]: ...
403403
404404_YieldT_co = TypeVar ("_YieldT_co" , covariant = True )
405- _SendT_contra = TypeVar ("_SendT_contra" , contravariant = True )
406- _ReturnT_co = TypeVar ("_ReturnT_co" , covariant = True )
405+ _SendT_contra = TypeVar ("_SendT_contra" , contravariant = True , default = None )
406+ _ReturnT_co = TypeVar ("_ReturnT_co" , covariant = True , default = None )
407407
408408class Generator (Iterator [_YieldT_co ], Generic [_YieldT_co , _SendT_contra , _ReturnT_co ]):
409409 def __next__ (self ) -> _YieldT_co : ...
@@ -445,7 +445,11 @@ class Awaitable(Protocol[_T_co]):
445445 @abstractmethod
446446 def __await__ (self ) -> Generator [Any , Any , _T_co ]: ...
447447
448- class Coroutine (Awaitable [_ReturnT_co ], Generic [_YieldT_co , _SendT_contra , _ReturnT_co ]):
448+ # Non-default variations to accommodate couroutines, and `AwaitableGenerator` having a 4th type parameter.
449+ _SendT_contra_nd = TypeVar ("_SendT_contra_nd" , contravariant = True )
450+ _ReturnT_co_nd = TypeVar ("_ReturnT_co_nd" , covariant = True )
451+
452+ class Coroutine (Awaitable [_ReturnT_co_nd ], Generic [_YieldT_co , _SendT_contra_nd , _ReturnT_co_nd ]):
449453 __name__ : str
450454 __qualname__ : str
451455 @property
@@ -457,7 +461,7 @@ class Coroutine(Awaitable[_ReturnT_co], Generic[_YieldT_co, _SendT_contra, _Retu
457461 @property
458462 def cr_running (self ) -> bool : ...
459463 @abstractmethod
460- def send (self , value : _SendT_contra , / ) -> _YieldT_co : ...
464+ def send (self , value : _SendT_contra_nd , / ) -> _YieldT_co : ...
461465 @overload
462466 @abstractmethod
463467 def throw (
@@ -473,9 +477,9 @@ class Coroutine(Awaitable[_ReturnT_co], Generic[_YieldT_co, _SendT_contra, _Retu
473477# The parameters correspond to Generator, but the 4th is the original type.
474478@type_check_only
475479class AwaitableGenerator (
476- Awaitable [_ReturnT_co ],
477- Generator [_YieldT_co , _SendT_contra , _ReturnT_co ],
478- Generic [_YieldT_co , _SendT_contra , _ReturnT_co , _S ],
480+ Awaitable [_ReturnT_co_nd ],
481+ Generator [_YieldT_co_nd , _SendT_contra_nd , _ReturnT_co_nd ],
482+ Generic [_YieldT_co_nd , _SendT_contra_nd , _ReturnT_co_nd , _S ],
479483 metaclass = ABCMeta ,
480484): ...
481485
0 commit comments