@@ -14,7 +14,7 @@ from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
1414from typing import IO , Any , Literal , Protocol , TypeVar , overload
1515from typing_extensions import Self , TypeAlias , TypeVarTuple , Unpack , deprecated
1616
17- from . import _AwaitableLike , _CoroutineLike
17+ from . import _AwaitableLike , _CoroutineLike , _TaskCompatibleCoro
1818from .base_events import Server
1919from .futures import Future
2020from .protocols import BaseProtocol
@@ -66,8 +66,20 @@ _ExceptionHandler: TypeAlias = Callable[[AbstractEventLoop, _Context], object]
6666_ProtocolFactory : TypeAlias = Callable [[], BaseProtocol ]
6767_SSLContext : TypeAlias = bool | None | ssl .SSLContext
6868
69- class _TaskFactory (Protocol ):
70- def __call__ (self , loop : AbstractEventLoop , factory : _CoroutineLike [_T ], / ) -> Future [_T ]: ...
69+ if sys .python_version >= (3 , 13 , 2 ):
70+ class _TaskFactory (Protocol ):
71+ def __call__ (
72+ self ,
73+ loop : AbstractEventLoop ,
74+ coro : _TaskCompatibleCoro [_T_co ],
75+ / ,
76+ * ,
77+ name : str | None = ...,
78+ context : Context | None = None ,
79+ eager_start : bool = False ,
80+ ) -> Task [_T ]: ...
81+ class _TaskFactory (Protocol ):
82+ def __call__ (self , loop : AbstractEventLoop , coro : _CoroutineLike [_T ], / ) -> Task [_T ]: ...
7183
7284class Handle :
7385 _cancelled : bool
@@ -164,7 +176,12 @@ class AbstractEventLoop:
164176 @abstractmethod
165177 def create_future (self ) -> Future [Any ]: ...
166178 # Tasks methods
167- if sys .version_info >= (3 , 11 ):
179+ if sys .version_info >= (3 , 13 , 2 ):
180+ @abstractmethod
181+ def create_task (
182+ self , coro : _TaskCompatibleCoro [_T ], * , name : str | None = None , context : Context | None = None , eager_start : bool | None = None
183+ ) -> Task [_T ]: ...
184+ elif sys .version_info >= (3 , 11 ):
168185 @abstractmethod
169186 def create_task (
170187 self , coro : _CoroutineLike [_T ], * , name : str | None = None , context : Context | None = None
0 commit comments