]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
util: Remove pre-py35 is_finalizing compatibility
authorBen Darnell <ben@bendarnell.com>
Fri, 7 Jun 2024 20:36:52 +0000 (16:36 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 8 Jun 2024 01:24:12 +0000 (21:24 -0400)
This code appears to be unused and in any case is unnecessary since
is_finalizing has been in the standard library since 3.5.

tornado/test/util_test.py
tornado/util.py

index 02cf0c19bd3a1fc316549945e25656d68f325630..7a6e817fd2b892761d8c5b68a2e8499e28d659f0 100644 (file)
@@ -14,7 +14,6 @@ from tornado.util import (
     timedelta_to_seconds,
     import_object,
     re_unescape,
-    is_finalizing,
 )
 
 import typing
@@ -301,8 +300,3 @@ class ReUnescapeTest(unittest.TestCase):
             re_unescape("\\b")
         with self.assertRaises(ValueError):
             re_unescape("\\Z")
-
-
-class IsFinalizingTest(unittest.TestCase):
-    def test_basic(self):
-        self.assertFalse(is_finalizing())
index 3a3a52f1f22e24c034752dd5764fb291b57b1d24..1fc2c69a52635753647cd9cfcb92894c11ba1460 100644 (file)
@@ -12,7 +12,6 @@ and `.Resolver`.
 
 import array
 import asyncio
-import atexit
 from inspect import getfullargspec
 import os
 import re
@@ -47,22 +46,6 @@ bytes_type = bytes
 unicode_type = str
 basestring_type = str
 
-try:
-    from sys import is_finalizing
-except ImportError:
-    # Emulate it
-    def _get_emulated_is_finalizing() -> Callable[[], bool]:
-        L = []  # type: List[None]
-        atexit.register(lambda: L.append(None))
-
-        def is_finalizing() -> bool:
-            # Not referencing any globals here
-            return L != []
-
-        return is_finalizing
-
-    is_finalizing = _get_emulated_is_finalizing()
-
 
 # versionchanged:: 6.2
 # no longer our own TimeoutError, use standard asyncio class