[Python-checkins] bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [streams] (GH-13671)

Miss Islington (bot) webhook-mailer at python.org
Wed Jun 5 01:45:58 EDT 2019


https://github.com/python/cpython/commit/6d64a8f49eb321116f585c4b036c81bb976d2d5c
commit: 6d64a8f49eb321116f585c4b036c81bb976d2d5c
branch: master
author: Emmanuel Arias <emmanuelarias30 at gmail.com>
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2019-06-04T22:45:53-07:00
summary:

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

files:
M Lib/asyncio/streams.py

diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 480f1a3fdd74..f03441b6b11d 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -175,6 +175,10 @@ def connect_write_pipe(pipe, *, limit=_DEFAULT_LIMIT):
                   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 @@ def connect_write_pipe(pipe, *, limit=_DEFAULT_LIMIT):
                   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 @@ def factory():
                       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 @@ def connect_unix(path=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)



More information about the Python-checkins mailing list