From: Thomas Kluyver Date: Sun, 29 Jan 2023 13:11:52 +0000 (+0000) Subject: Undeprecate ioloop make_current and clear_current methods X-Git-Tag: v6.3.0b1~8^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b91cef24b882b9e95a9399d3c4fcd416f57a0ef;p=thirdparty%2Ftornado.git Undeprecate ioloop make_current and clear_current methods --- diff --git a/tornado/ioloop.py b/tornado/ioloop.py index 25609790d..8245d34a2 100644 --- a/tornado/ioloop.py +++ b/tornado/ioloop.py @@ -33,7 +33,6 @@ import sys import time import math import random -import warnings from inspect import isawaitable from tornado.concurrent import ( @@ -123,8 +122,7 @@ class IOLoop(Configurable): and instead initialize the `asyncio` event loop and use `IOLoop.current()`. In some cases, such as in test frameworks when initializing an `IOLoop` to be run in a secondary thread, it may be appropriate to construct - an `IOLoop` with ``IOLoop(make_current=False)``. Constructing an `IOLoop` - without the ``make_current=False`` argument is deprecated since Tornado 6.2. + an `IOLoop` with ``IOLoop(make_current=False)``. In general, an `IOLoop` cannot survive a fork or be shared across processes in any way. When multiple processes are being used, each process should @@ -144,13 +142,6 @@ class IOLoop(Configurable): Uses the `asyncio` event loop by default. The ``IOLoop.configure`` method cannot be used on Python 3 except to redundantly specify the `asyncio` event loop. - - .. deprecated:: 6.2 - It is deprecated to create an event loop that is "current" but not - running. This means it is deprecated to pass - ``make_current=True`` to the ``IOLoop`` constructor, or to create - an ``IOLoop`` while no asyncio event loop is running unless - ``make_current=False`` is used. """ # These constants were originally based on constants from the epoll module. @@ -293,13 +284,6 @@ class IOLoop(Configurable): .. versionchanged:: 5.0 This method also sets the current `asyncio` event loop. - - .. deprecated:: 6.2 - The concept of an event loop that is "current" without - currently running is deprecated in asyncio since Python - 3.10. All related functionality in Tornado is also - deprecated. Instead, start the event loop with `asyncio.run` - before interacting with it. """ # The asyncio event loops override this method. raise NotImplementedError() @@ -312,13 +296,7 @@ class IOLoop(Configurable): .. versionchanged:: 5.0 This method also clears the current `asyncio` event loop. - .. deprecated:: 6.2 """ - warnings.warn( - "clear_current is deprecated", - DeprecationWarning, - stacklevel=2, - ) IOLoop._clear_current() @staticmethod diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index a3fbdc37e..779e339c9 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -328,11 +328,6 @@ class AsyncIOLoop(BaseAsyncIOLoop): super().close(all_fds=all_fds) def make_current(self) -> None: - warnings.warn( - "make_current is deprecated; start the event loop first", - DeprecationWarning, - stacklevel=2, - ) if not self.is_current: try: self.old_asyncio = asyncio.get_event_loop()