]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
ioloop: Remove IOLoop.initialized() 2252/head
authorBen Darnell <ben@bendarnell.com>
Sun, 21 Jan 2018 19:01:42 +0000 (14:01 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 27 Jan 2018 01:34:29 +0000 (20:34 -0500)
It is no longer possible to provide this method with reasonable
semantics.

docs/ioloop.rst
docs/releases/v5.0.0.rst
tornado/ioloop.py
tornado/process.py
tornado/test/process_test.py

index fb41f2d65c48c9e27e0d458e156120eb6ab1bba4..2c5fdc2cd28237732a0ca0407ca238643fa7d4a9 100644 (file)
@@ -19,7 +19,6 @@
    .. automethod:: IOLoop.run_sync
    .. automethod:: IOLoop.close
    .. automethod:: IOLoop.instance
-   .. automethod:: IOLoop.initialized
    .. automethod:: IOLoop.install
    .. automethod:: IOLoop.clear_instance
 
index 8d9b56ba6dd7acc6b5949d14eda305dcaca3d174..e9633fe83dc23592e5bb45e4a8e61d49c48952c9 100644 (file)
@@ -167,8 +167,8 @@ Other notes
 - ``tornado.ioloop.TimeoutError`` is now an alias for
   `tornado.util.TimeoutError`.
 - `.IOLoop.instance` is now a deprecated alias for `.IOLoop.current`.
-- `.IOLoop.initialized`, `.IOLoop.install`, and
-  `.IOLoop.clear_instance` are all deprecated.
+- `.IOLoop.install` and `.IOLoop.clear_instance` are deprecated.
+- ``IOLoop.initialized`` has been removed.
 - On Python 3, the `asyncio`-backed `.IOLoop` is always used and
   alternative `.IOLoop` implementations cannot be configured.
 - `~.IOLoop.run_sync` cancels its argument on a timeout. This
index 2e09b32b9a63033f4af84ad503b75e66086ade45..493cbea94d27265ee591e64f1a865c7533ddeb6a 100644 (file)
@@ -221,29 +221,6 @@ class IOLoop(Configurable):
         """
         return IOLoop.current()
 
-    @staticmethod
-    def initialized():
-        """Returns true if there is a current IOLoop.
-
-        .. versionchanged:: 5.0
-
-           Redefined in terms of `current()` instead of `instance()`.
-
-        .. deprecated:: 5.0
-
-           This method only knows about `IOLoop` objects (and not, for
-           example, `asyncio` event loops), so it is of limited use.
-        """
-        if asyncio is None:
-            return IOLoop.current(instance=False) is not None
-        else:
-            # Asyncio gives us no way to ask whether an instance
-            # exists without creating one. Even calling
-            # `IOLoop.current(instance=False)` will create the asyncio
-            # loop (but not the Tornado loop, which would break the
-            # ability to use this function for "is it safe to fork?".
-            return False
-
     def install(self):
         """Deprecated alias for `make_current()`.
 
index cedea40aaf4ca8081f035f67bddc649d15dc2f30..122fd7e14b47bf478ee8a93570f76c16c6e9f370 100644 (file)
@@ -125,10 +125,6 @@ def fork_processes(num_processes, max_restarts=100):
     assert _task_id is None
     if num_processes is None or num_processes <= 0:
         num_processes = cpu_count()
-    if ioloop.IOLoop.initialized():
-        raise RuntimeError("Cannot run in multiple processes: IOLoop instance "
-                           "has already been initialized. You cannot call "
-                           "IOLoop.instance() before calling start_processes()")
     gen_log.info("Starting %d processes", num_processes)
     children = {}
 
index 638613e4f808664ad28b32677caee1cf948178d3..4589e51bcc07741ffa1a8b5bf05e4c71eb4bca47 100644 (file)
@@ -66,7 +66,6 @@ class ProcessTest(unittest.TestCase):
         # place for it).
         skip_if_twisted()
         with ExpectLog(gen_log, "(Starting .* processes|child .* exited|uncaught exception)"):
-            self.assertFalse(IOLoop.initialized())
             sock, port = bind_unused_port()
 
             def get_url(path):