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, *,

175175

stacklevel=2)

176176

if loop is None:

177177

loop = 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)

178182

reader = StreamReader(limit=limit, loop=loop)

179183

protocol = StreamReaderProtocol(reader, loop=loop, _asyncio_internal=True)

180184

transport, _ = await loop.create_connection(

@@ -213,6 +217,10 @@ async def start_server(client_connected_cb, host=None, port=None, *,

213217

stacklevel=2)

214218

if loop is None:

215219

loop = 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)

216224217225

def factory():

218226

reader = StreamReader(limit=limit, loop=loop)

@@ -414,6 +422,10 @@ async def open_unix_connection(path=None, *,

414422

stacklevel=2)

415423

if loop is None:

416424

loop = 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)

417429

reader = StreamReader(limit=limit, loop=loop)

418430

protocol = StreamReaderProtocol(reader, loop=loop,

419431

_asyncio_internal=True)

@@ -473,6 +485,10 @@ async def start_unix_server(client_connected_cb, path=None, *,

473485

stacklevel=2)

474486

if loop is None:

475487

loop = 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)

476492477493

def factory():

478494

reader = StreamReader(limit=limit, loop=loop)