@@ -12,7 +12,6 @@ from re import Match as Match, Pattern as Pattern
1212from types import (
1313 BuiltinFunctionType ,
1414 CodeType ,
15- FrameType ,
1615 FunctionType ,
1716 MethodDescriptorType ,
1817 MethodType ,
@@ -473,7 +472,8 @@ _YieldT_co = TypeVar("_YieldT_co", covariant=True)
473472_SendT_contra = TypeVar ("_SendT_contra" , contravariant = True , default = None )
474473_ReturnT_co = TypeVar ("_ReturnT_co" , covariant = True , default = None )
475474
476- class Generator (Iterator [_YieldT_co ], Generic [_YieldT_co , _SendT_contra , _ReturnT_co ]):
475+ @runtime_checkable
476+ class Generator (Iterator [_YieldT_co ], Protocol [_YieldT_co , _SendT_contra , _ReturnT_co ]):
477477 def __next__ (self ) -> _YieldT_co : ...
478478 @abstractmethod
479479 def send (self , value : _SendT_contra , / ) -> _YieldT_co : ...
@@ -491,14 +491,6 @@ class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _Return
491491 def close (self ) -> None : ...
492492
493493 def __iter__ (self ) -> Generator [_YieldT_co , _SendT_contra , _ReturnT_co ]: ...
494- @property
495- def gi_code (self ) -> CodeType : ...
496- @property
497- def gi_frame (self ) -> FrameType : ...
498- @property
499- def gi_running (self ) -> bool : ...
500- @property
501- def gi_yieldfrom (self ) -> Generator [Any , Any , Any ] | None : ...
502494
503495# NOTE: Prior to Python 3.13 these aliases are lacking the second _ExitT_co parameter
504496if sys .version_info >= (3 , 13 ):
@@ -524,14 +516,7 @@ _ReturnT_co_nd = TypeVar("_ReturnT_co_nd", covariant=True)
524516class Coroutine (Awaitable [_ReturnT_co_nd ], Generic [_YieldT_co , _SendT_contra_nd , _ReturnT_co_nd ]):
525517 __name__ : str
526518 __qualname__ : str
527- @property
528- def cr_await (self ) -> Any | None : ...
529- @property
530- def cr_code (self ) -> CodeType : ...
531- @property
532- def cr_frame (self ) -> FrameType | None : ...
533- @property
534- def cr_running (self ) -> bool : ...
519+
535520 @abstractmethod
536521 def send (self , value : _SendT_contra_nd , / ) -> _YieldT_co : ...
537522 @overload
@@ -566,7 +551,8 @@ class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]):
566551 def __anext__ (self ) -> Awaitable [_T_co ]: ...
567552 def __aiter__ (self ) -> AsyncIterator [_T_co ]: ...
568553
569- class AsyncGenerator (AsyncIterator [_YieldT_co ], Generic [_YieldT_co , _SendT_contra ]):
554+ @runtime_checkable
555+ class AsyncGenerator (AsyncIterator [_YieldT_co ], Protocol [_YieldT_co , _SendT_contra ]):
570556 def __anext__ (self ) -> Coroutine [Any , Any , _YieldT_co ]: ...
571557 @abstractmethod
572558 def asend (self , value : _SendT_contra , / ) -> Coroutine [Any , Any , _YieldT_co ]: ...
@@ -581,14 +567,6 @@ class AsyncGenerator(AsyncIterator[_YieldT_co], Generic[_YieldT_co, _SendT_contr
581567 self , typ : BaseException , val : None = None , tb : TracebackType | None = None , /
582568 ) -> Coroutine [Any , Any , _YieldT_co ]: ...
583569 def aclose (self ) -> Coroutine [Any , Any , None ]: ...
584- @property
585- def ag_await (self ) -> Any : ...
586- @property
587- def ag_code (self ) -> CodeType : ...
588- @property
589- def ag_frame (self ) -> FrameType : ...
590- @property
591- def ag_running (self ) -> bool : ...
592570
593571@runtime_checkable
594572class Container (Protocol [_T_co ]):
0 commit comments