@@ -6,6 +6,7 @@ from typing import (
6
6
AsyncGenerator ,
7
7
Awaitable ,
8
8
Callable ,
9
+ Coroutine ,
9
10
Generator ,
10
11
Generic ,
11
12
ItemsView ,
@@ -211,20 +212,22 @@ class AsyncGeneratorType(AsyncGenerator[_T_co, _T_contra]):
211
212
def aclose (self ) -> Awaitable [None ]: ...
212
213
213
214
@final
214
- class CoroutineType :
215
+ class CoroutineType ( Coroutine [ _T_co , _T_contra , _V_co ]) :
215
216
__name__ : str
216
217
__qualname__ : str
217
218
cr_await : Any | None
218
219
cr_code : CodeType
219
220
cr_frame : FrameType
220
221
cr_running : bool
221
222
def close (self ) -> None : ...
222
- def __await__ (self ) -> Generator [Any , None , Any ]: ...
223
- def send (self , __arg : Any ) -> Any : ...
223
+ def __await__ (self ) -> Generator [Any , None , _V_co ]: ...
224
+ def send (self , __arg : _T_contra ) -> _T_co : ...
224
225
@overload
225
- def throw (self , __typ : Type [BaseException ], __val : BaseException | object = ..., __tb : TracebackType | None = ...) -> Any : ...
226
+ def throw (
227
+ self , __typ : Type [BaseException ], __val : BaseException | object = ..., __tb : TracebackType | None = ...
228
+ ) -> _T_co : ...
226
229
@overload
227
- def throw (self , __typ : BaseException , __val : None = ..., __tb : TracebackType | None = ...) -> Any : ...
230
+ def throw (self , __typ : BaseException , __val : None = ..., __tb : TracebackType | None = ...) -> _T_co : ...
228
231
229
232
class _StaticFunctionType :
230
233
"""Fictional type to correct the type of MethodType.__func__.
@@ -365,7 +368,7 @@ def prepare_class(
365
368
# Actually a different type, but `property` is special and we want that too.
366
369
DynamicClassAttribute = property
367
370
368
- def coroutine (func : Callable [..., Any ]) -> CoroutineType : ...
371
+ def coroutine (func : Callable [..., Any ]) -> CoroutineType [ Any , Any , Any ] : ...
369
372
370
373
if sys .version_info >= (3 , 8 ):
371
374
CellType = _Cell
0 commit comments