bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
index e4f9e52..bddfb01 100644
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -224,6 +224,13 @@
**kwds):
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
+ )
+
protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
loop=loop,
_asyncio_internal=True)
@@ -239,6 +246,12 @@
limit=streams._DEFAULT_LIMIT, **kwds):
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
+ )
protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
loop=loop,
_asyncio_internal=True)