summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/streams.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-05 06:01:01 (GMT)
committerGitHub <noreply@github.com>2019-06-05 06:01:01 (GMT)
commit8899b11b95f08e2e03478f2acad336ad5933a2d1 (patch)
treec3d9977ea22dd10add6b67afa6c40e02dfb5da6d /Lib/asyncio/streams.py
parent39346ff60ac14bb83521c7e4f87304d0ad6478c2 (diff)
downloadcpython-8899b11b95f08e2e03478f2acad336ad5933a2d1.zip
cpython-8899b11b95f08e2e03478f2acad336ad5933a2d1.tar.gz
cpython-8899b11b95f08e2e03478f2acad336ad5933a2d1.tar.bz2
bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [streams] (GH-13671)
This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. Second step: streams.py https://bugs.python.org/issue36373 (cherry picked from commit 6d64a8f49eb321116f585c4b036c81bb976d2d5c) Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r--Lib/asyncio/streams.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 480f1a3..f03441b 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -175,6 +175,10 @@ async def open_connection(host=None, port=None, *,
stacklevel=2)
if loop is None:
loop = events.get_event_loop()
+ else:
+ warnings.warn("The loop argument is deprecated since Python 3.8, "
+ "and scheduled for removal in Python 3.10.",
+ DeprecationWarning, stacklevel=2)
reader = StreamReader(limit=limit, loop=loop)
protocol = StreamReaderProtocol(reader, loop=loop, _asyncio_internal=True)
transport, _ = await loop.create_connection(
@@ -213,6 +217,10 @@ async def start_server(client_connected_cb, host=None, port=None, *,
stacklevel=2)
if loop is None:
loop = events.get_event_loop()
+ else:
+ warnings.warn("The loop argument is deprecated since Python 3.8, "
+ "and scheduled for removal in Python 3.10.",
+ DeprecationWarning, stacklevel=2)
def factory():
reader = StreamReader(limit=limit, loop=loop)
@@ -414,6 +422,10 @@ if hasattr(socket, 'AF_UNIX'):
stacklevel=2)
if loop is None:
loop = events.get_event_loop()
+ else:
+ warnings.warn("The loop argument is deprecated since Python 3.8, "
+ "and scheduled for removal in Python 3.10.",
+ DeprecationWarning, stacklevel=2)
reader = StreamReader(limit=limit, loop=loop)
protocol = StreamReaderProtocol(reader, loop=loop,
_asyncio_internal=True)
@@ -473,6 +485,10 @@ if hasattr(socket, 'AF_UNIX'):
stacklevel=2)
if loop is None:
loop = events.get_event_loop()
+ else:
+ warnings.warn("The loop argument is deprecated since Python 3.8, "
+ "and scheduled for removal in Python 3.10.",
+ DeprecationWarning, stacklevel=2)
def factory():
reader = StreamReader(limit=limit, loop=loop)