bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [queue] ...
authorEmmanuel Arias <emmanuelarias30@gmail.com>
Tue, 10 Sep 2019 11:46:12 +0000 (08:46 -0300)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Sep 2019 11:46:12 +0000 (04:46 -0700)
This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

fourth step: queue.py

https://bugs.python.org/issue36373

Doc/library/asyncio-queue.rst
Lib/asyncio/queues.py

index 7be1023c80cc66ceb4126b6753cf128061725ad5..e7775da54f589138407aec5114c565c471cf084c 100644 (file)
@@ -32,6 +32,10 @@ Queue
    the queue is always known and can be returned by calling the
    :meth:`qsize` method.
 
+   .. deprecated-removed:: 3.8 3.10
+      The *loop* parameter.
+
+
    This class is :ref:`not thread safe <asyncio-multithreading>`.
 
    .. attribute:: maxsize
index 2a8d3e76044109c4761bc85f31bcee2aef1a2bbb..c96b4a0c1ba3274a953ac1c7e6614900d2257bd2 100644 (file)
@@ -2,6 +2,7 @@ __all__ = ('Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty')
 
 import collections
 import heapq
+import warnings
 
 from . import events
 from . import locks
@@ -34,6 +35,9 @@ class Queue:
             self._loop = events.get_event_loop()
         else:
             self._loop = loop
+            warnings.warn("The loop argument is deprecated since Python 3.8, "
+                          "and scheduled for removal in Python 3.10.",
+                          DeprecationWarning, stacklevel=2)
         self._maxsize = maxsize
 
         # Futures.