@@ -16,23 +16,40 @@ from .tasks import Task
1616from .transports import BaseTransport , DatagramTransport , ReadTransport , SubprocessTransport , Transport , WriteTransport
1717from .unix_events import AbstractChildWatcher
1818
19- __all__ = (
20- "AbstractEventLoopPolicy" ,
21- "AbstractEventLoop" ,
22- "AbstractServer" ,
23- "Handle" ,
24- "TimerHandle" ,
25- "get_event_loop_policy" ,
26- "set_event_loop_policy" ,
27- "get_event_loop" ,
28- "set_event_loop" ,
29- "new_event_loop" ,
30- "get_child_watcher" ,
31- "set_child_watcher" ,
32- "_set_running_loop" ,
33- "get_running_loop" ,
34- "_get_running_loop" ,
35- )
19+ if sys .version_info >= (3 , 14 ):
20+ __all__ = (
21+ "AbstractEventLoopPolicy" ,
22+ "AbstractEventLoop" ,
23+ "AbstractServer" ,
24+ "Handle" ,
25+ "TimerHandle" ,
26+ "get_event_loop_policy" ,
27+ "set_event_loop_policy" ,
28+ "get_event_loop" ,
29+ "set_event_loop" ,
30+ "new_event_loop" ,
31+ "_set_running_loop" ,
32+ "get_running_loop" ,
33+ "_get_running_loop" ,
34+ )
35+ else :
36+ __all__ = (
37+ "AbstractEventLoopPolicy" ,
38+ "AbstractEventLoop" ,
39+ "AbstractServer" ,
40+ "Handle" ,
41+ "TimerHandle" ,
42+ "get_event_loop_policy" ,
43+ "set_event_loop_policy" ,
44+ "get_event_loop" ,
45+ "set_event_loop" ,
46+ "new_event_loop" ,
47+ "get_child_watcher" ,
48+ "set_child_watcher" ,
49+ "_set_running_loop" ,
50+ "get_running_loop" ,
51+ "_get_running_loop" ,
52+ )
3653
3754_T = TypeVar ("_T" )
3855_Ts = TypeVarTuple ("_Ts" )
@@ -541,18 +558,19 @@ class AbstractEventLoopPolicy:
541558 @abstractmethod
542559 def new_event_loop (self ) -> AbstractEventLoop : ...
543560 # Child processes handling (Unix only).
544- if sys .version_info >= (3 , 12 ):
545- @abstractmethod
546- @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
547- def get_child_watcher (self ) -> AbstractChildWatcher : ...
548- @abstractmethod
549- @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
550- def set_child_watcher (self , watcher : AbstractChildWatcher ) -> None : ...
551- else :
552- @abstractmethod
553- def get_child_watcher (self ) -> AbstractChildWatcher : ...
554- @abstractmethod
555- def set_child_watcher (self , watcher : AbstractChildWatcher ) -> None : ...
561+ if sys .version_info < (3 , 14 ):
562+ if sys .version_info >= (3 , 12 ):
563+ @abstractmethod
564+ @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
565+ def get_child_watcher (self ) -> AbstractChildWatcher : ...
566+ @abstractmethod
567+ @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
568+ def set_child_watcher (self , watcher : AbstractChildWatcher ) -> None : ...
569+ else :
570+ @abstractmethod
571+ def get_child_watcher (self ) -> AbstractChildWatcher : ...
572+ @abstractmethod
573+ def set_child_watcher (self , watcher : AbstractChildWatcher ) -> None : ...
556574
557575class BaseDefaultEventLoopPolicy (AbstractEventLoopPolicy , metaclass = ABCMeta ):
558576 def get_event_loop (self ) -> AbstractEventLoop : ...
@@ -565,15 +583,16 @@ def get_event_loop() -> AbstractEventLoop: ...
565583def set_event_loop (loop : AbstractEventLoop | None ) -> None : ...
566584def new_event_loop () -> AbstractEventLoop : ...
567585
568- if sys .version_info >= (3 , 12 ):
569- @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
570- def get_child_watcher () -> AbstractChildWatcher : ...
571- @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
572- def set_child_watcher (watcher : AbstractChildWatcher ) -> None : ...
586+ if sys .version_info < (3 , 14 ):
587+ if sys .version_info >= (3 , 12 ):
588+ @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
589+ def get_child_watcher () -> AbstractChildWatcher : ...
590+ @deprecated ("Deprecated as of Python 3.12; will be removed in Python 3.14" )
591+ def set_child_watcher (watcher : AbstractChildWatcher ) -> None : ...
573592
574- else :
575- def get_child_watcher () -> AbstractChildWatcher : ...
576- def set_child_watcher (watcher : AbstractChildWatcher ) -> None : ...
593+ else :
594+ def get_child_watcher () -> AbstractChildWatcher : ...
595+ def set_child_watcher (watcher : AbstractChildWatcher ) -> None : ...
577596
578597def _set_running_loop (loop : AbstractEventLoop | None , / ) -> None : ...
579598def _get_running_loop () -> AbstractEventLoop : ...
0 commit comments