From 37f7f5307d27dc73f6bb8bb2eab180f41a93bdec Mon Sep 17 00:00:00 2001 From: eamanu Date: Mon, 10 Jun 2019 20:22:51 -0300 Subject: [PATCH] Deprecate explicit loop in all public asyncio This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. fourth step: queue.py --- Doc/library/asyncio-queue.rst | 4 ++++ Lib/asyncio/queues.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Doc/library/asyncio-queue.rst b/Doc/library/asyncio-queue.rst index 7be1023c80cc66..e7775da54f5891 100644 --- a/Doc/library/asyncio-queue.rst +++ b/Doc/library/asyncio-queue.rst @@ -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 `. .. attribute:: maxsize diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py index 2a8d3e76044109..c96b4a0c1ba327 100644 --- a/Lib/asyncio/queues.py +++ b/Lib/asyncio/queues.py @@ -2,6 +2,7 @@ import collections import heapq +import warnings from . import events from . import locks @@ -34,6 +35,9 @@ def __init__(self, maxsize=0, *, loop=None): 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.