23
23
24
24
25
25
async def open_connection (host = None , port = None , * ,
26
- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
26
+ limit = _DEFAULT_LIMIT , ** kwds ):
27
27
"""A wrapper for create_connection() returning a (reader, writer) pair.
28
28
29
29
The reader returned is a StreamReader instance; the writer is a
@@ -41,12 +41,7 @@ async def open_connection(host=None, port=None, *,
41
41
StreamReaderProtocol classes, just copy the code -- there's
42
42
really nothing special here except some convenience.)
43
43
"""
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 ()
50
45
reader = StreamReader (limit = limit , loop = loop )
51
46
protocol = StreamReaderProtocol (reader , loop = loop )
52
47
transport , _ = await loop .create_connection (
@@ -56,7 +51,7 @@ async def open_connection(host=None, port=None, *,
56
51
57
52
58
53
async def start_server (client_connected_cb , host = None , port = None , * ,
59
- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
54
+ limit = _DEFAULT_LIMIT , ** kwds ):
60
55
"""Start a socket server, call back for each client connected.
61
56
62
57
The first parameter, `client_connected_cb`, takes two parameters:
@@ -78,12 +73,7 @@ async def start_server(client_connected_cb, host=None, port=None, *,
78
73
The return value is the same as loop.create_server(), i.e. a
79
74
Server object which can be used to stop the service.
80
75
"""
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 ()
87
77
88
78
def factory ():
89
79
reader = StreamReader (limit = limit , loop = loop )
@@ -98,14 +88,10 @@ def factory():
98
88
# UNIX Domain Sockets are supported on this platform
99
89
100
90
async def open_unix_connection (path = None , * ,
101
- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
91
+ limit = _DEFAULT_LIMIT , ** kwds ):
102
92
"""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
+
109
95
reader = StreamReader (limit = limit , loop = loop )
110
96
protocol = StreamReaderProtocol (reader , loop = loop )
111
97
transport , _ = await loop .create_unix_connection (
@@ -114,14 +100,9 @@ async def open_unix_connection(path=None, *,
114
100
return reader , writer
115
101
116
102
async def start_unix_server (client_connected_cb , path = None , * ,
117
- loop = None , limit = _DEFAULT_LIMIT , ** kwds ):
103
+ limit = _DEFAULT_LIMIT , ** kwds ):
118
104
"""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 ()
125
106
126
107
def factory ():
127
108
reader = StreamReader (limit = limit , loop = loop )
0 commit comments