2323
2424
2525async def open_connection (host = None , port = None , * ,
26- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
26+ limit = _DEFAULT_LIMIT , ** kwds ):
2727 """A wrapper for create_connection() returning a (reader, writer) pair.
2828
2929 The reader returned is a StreamReader instance; the writer is a
@@ -41,12 +41,7 @@ async def open_connection(host=None, port=None, *,
4141 StreamReaderProtocol classes, just copy the code -- there's
4242 really nothing special here except some convenience.)
4343 """
44- if loop is None :
45- loop = events .get_event_loop ()
46- else :
47- warnings .warn ("The loop argument is deprecated since Python 3.8, "
48- "and scheduled for removal in Python 3.10." ,
49- DeprecationWarning , stacklevel = 2 )
44+ loop = events .get_running_loop ()
5045 reader = StreamReader (limit = limit , loop = loop )
5146 protocol = StreamReaderProtocol (reader , loop = loop )
5247 transport , _ = await loop .create_connection (
@@ -56,7 +51,7 @@ async def open_connection(host=None, port=None, *,
5651
5752
5853async def start_server (client_connected_cb , host = None , port = None , * ,
59- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
54+ limit = _DEFAULT_LIMIT , ** kwds ):
6055 """Start a socket server, call back for each client connected.
6156
6257 The first parameter, `client_connected_cb`, takes two parameters:
@@ -78,12 +73,7 @@ async def start_server(client_connected_cb, host=None, port=None, *,
7873 The return value is the same as loop.create_server(), i.e. a
7974 Server object which can be used to stop the service.
8075 """
81- if loop is None :
82- loop = events .get_event_loop ()
83- else :
84- warnings .warn ("The loop argument is deprecated since Python 3.8, "
85- "and scheduled for removal in Python 3.10." ,
86- DeprecationWarning , stacklevel = 2 )
76+ loop = events .get_running_loop ()
8777
8878 def factory ():
8979 reader = StreamReader (limit = limit , loop = loop )
@@ -98,14 +88,10 @@ def factory():
9888 # UNIX Domain Sockets are supported on this platform
9989
10090 async def open_unix_connection (path = None , * ,
101- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
91+ limit = _DEFAULT_LIMIT , ** kwds ):
10292 """Similar to `open_connection` but works with UNIX Domain Sockets."""
103- if loop is None :
104- loop = events .get_event_loop ()
105- else :
106- warnings .warn ("The loop argument is deprecated since Python 3.8, "
107- "and scheduled for removal in Python 3.10." ,
108- DeprecationWarning , stacklevel = 2 )
93+ loop = events .get_running_loop ()
94+
10995 reader = StreamReader (limit = limit , loop = loop )
11096 protocol = StreamReaderProtocol (reader , loop = loop )
11197 transport , _ = await loop .create_unix_connection (
@@ -114,14 +100,9 @@ async def open_unix_connection(path=None, *,
114100 return reader , writer
115101
116102 async def start_unix_server (client_connected_cb , path = None , * ,
117- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
103+ limit = _DEFAULT_LIMIT , ** kwds ):
118104 """Similar to `start_server` but works with UNIX Domain Sockets."""
119- if loop is None :
120- loop = events .get_event_loop ()
121- else :
122- warnings .warn ("The loop argument is deprecated since Python 3.8, "
123- "and scheduled for removal in Python 3.10." ,
124- DeprecationWarning , stacklevel = 2 )
105+ loop = events .get_running_loop ()
125106
126107 def factory ():
127108 reader = StreamReader (limit = limit , loop = loop )
0 commit comments