From 4aabe0da77fa4e104287bc8459e25a1147520c50 Mon Sep 17 00:00:00 2001 From: Emmanuel Arias Date: Wed, 6 Nov 2019 19:28:52 -0300 Subject: [PATCH] Add a deprectation warning for queue w/o event running loop --- Lib/asyncio/queues.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py index 390ae9a682..feb9a3b14e 100644 --- a/Lib/asyncio/queues.py +++ b/Lib/asyncio/queues.py @@ -40,6 +40,12 @@ class Queue: DeprecationWarning, stacklevel=2) self._maxsize = maxsize + if not self._loop.is_running(): + warnings.warn("The asyncio objects created without running " + "event loop is deprecated since Python 3.9 and " + "scheduled for removal in Python 3.10.", + DeprecationWarning, stacklevel=2) + # Futures. self._getters = collections.deque() # Futures. -- 2.11.0