bpo-36373: Deprecate explicit loop parameter in all public asyncio A… · python/cpython@8899b11
@@ -175,6 +175,10 @@ async def open_connection(host=None, port=None, *,
175175stacklevel=2)
176176if loop is None:
177177loop = events.get_event_loop()
178+else:
179+warnings.warn("The loop argument is deprecated since Python 3.8, "
180+"and scheduled for removal in Python 3.10.",
181+DeprecationWarning, stacklevel=2)
178182reader = StreamReader(limit=limit, loop=loop)
179183protocol = StreamReaderProtocol(reader, loop=loop, _asyncio_internal=True)
180184transport, _ = await loop.create_connection(
@@ -213,6 +217,10 @@ async def start_server(client_connected_cb, host=None, port=None, *,
213217stacklevel=2)
214218if loop is None:
215219loop = events.get_event_loop()
220+else:
221+warnings.warn("The loop argument is deprecated since Python 3.8, "
222+"and scheduled for removal in Python 3.10.",
223+DeprecationWarning, stacklevel=2)
216224217225def factory():
218226reader = StreamReader(limit=limit, loop=loop)
@@ -414,6 +422,10 @@ async def open_unix_connection(path=None, *,
414422stacklevel=2)
415423if loop is None:
416424loop = events.get_event_loop()
425+else:
426+warnings.warn("The loop argument is deprecated since Python 3.8, "
427+"and scheduled for removal in Python 3.10.",
428+DeprecationWarning, stacklevel=2)
417429reader = StreamReader(limit=limit, loop=loop)
418430protocol = StreamReaderProtocol(reader, loop=loop,
419431_asyncio_internal=True)
@@ -473,6 +485,10 @@ async def start_unix_server(client_connected_cb, path=None, *,
473485stacklevel=2)
474486if loop is None:
475487loop = events.get_event_loop()
488+else:
489+warnings.warn("The loop argument is deprecated since Python 3.8, "
490+"and scheduled for removal in Python 3.10.",
491+DeprecationWarning, stacklevel=2)
476492477493def factory():
478494reader = StreamReader(limit=limit, loop=loop)