]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
concurrent: Remove TracebackFuture alias
authorBen Darnell <ben@bendarnell.com>
Mon, 5 Jun 2017 00:39:44 +0000 (20:39 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 5 Nov 2017 16:17:50 +0000 (11:17 -0500)
docs/concurrent.rst
docs/conf.py
tornado/auth.py
tornado/concurrent.py
tornado/gen.py
tornado/httpclient.py
tornado/ioloop.py
tornado/iostream.py
tornado/websocket.py

index 72047811b5b04bb77d7e36c401c08e1de5d0d156..049eb6ff7de343328a40a8456e6a4b6aac956c01 100644 (file)
@@ -8,7 +8,7 @@
 
 .. automodule:: tornado.concurrent
     :members:
-    :exclude-members: Future, TracebackFuture
+    :exclude-members: Future
 
     .. autoclass:: Future
 
index 5bc6635b52b5a6dcec26220ab25a600fbe25235d..e64eb86670b1678e79c22cbb33553b79c537f758 100644 (file)
@@ -39,9 +39,6 @@ coverage_ignore_modules = [
     ]
 # I wish this could go in a per-module file...
 coverage_ignore_classes = [
-    # tornado.concurrent
-    "TracebackFuture",
-
     # tornado.gen
     "Runner",
 
index 93f771bc4bb42f5fd262130e70e7a20925446da8..f6d505a20711969d77ea8919dfa2703697699e57 100644 (file)
@@ -75,7 +75,7 @@ import hmac
 import time
 import uuid
 
-from tornado.concurrent import TracebackFuture, return_future, chain_future, future_set_exc_info
+from tornado.concurrent import Future, return_future, chain_future, future_set_exc_info
 from tornado import gen
 from tornado import httpclient
 from tornado import escape
@@ -117,7 +117,7 @@ def _auth_return_future(f):
 
     @functools.wraps(f)
     def wrapper(*args, **kwargs):
-        future = TracebackFuture()
+        future = Future()
         callback, args, kwargs = replacer.replace(future, args, kwargs)
         if callback is not None:
             future.add_done_callback(
index 08c0e0b754a533d1d9aa6b348d78cc018c4778da..5f723dfede1b4b204753de30a6564b9879ba0016 100644 (file)
@@ -146,8 +146,6 @@ class Future(object):
     and ``set_exc_info`` are supported to capture tracebacks in Python 2.
     The traceback is automatically available in Python 3, but in the
     Python 2 futures backport this information is discarded.
-    This functionality was previously available in a separate class
-    ``TracebackFuture``, which is now a deprecated alias for this class.
 
     .. versionchanged:: 4.0
        `tornado.concurrent.Future` is always a thread-unsafe ``Future``
@@ -164,6 +162,10 @@ class Future(object):
        where it results in undesired logging it may be necessary to
        suppress the logging by ensuring that the exception is observed:
        ``f.add_done_callback(lambda f: f.exception())``.
+
+    .. versionchanged:: 5.0
+       This class was previoiusly available under the name ``TracebackFuture``.
+       This name, which was deprecated since version 4.0, has been removed.
     """
     def __init__(self):
         self._done = False
@@ -344,8 +346,6 @@ class Future(object):
                           self, ''.join(tb).rstrip())
 
 
-TracebackFuture = Future
-
 if futures is None:
     FUTURES = Future  # type: typing.Union[type, typing.Tuple[type, ...]]
 else:
@@ -358,7 +358,7 @@ def is_future(x):
 
 class DummyExecutor(object):
     def submit(self, fn, *args, **kwargs):
-        future = TracebackFuture()
+        future = Future()
         try:
             future.set_result(fn(*args, **kwargs))
         except Exception:
@@ -460,7 +460,7 @@ def return_future(f):
 
     @functools.wraps(f)
     def wrapper(*args, **kwargs):
-        future = TracebackFuture()
+        future = Future()
         callback, args, kwargs = replacer.replace(
             lambda value=_NO_RESULT: future.set_result(value),
             args, kwargs)
index 7368cb67c8d62e7b392d1e8c2a99b8ccd7e208ed..92eef367a531bc89013a7d5b6b624ba057a28685 100644 (file)
@@ -85,7 +85,7 @@ import textwrap
 import types
 import weakref
 
-from tornado.concurrent import Future, TracebackFuture, is_future, chain_future, future_set_exc_info
+from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info
 from tornado.ioloop import IOLoop
 from tornado.log import app_log
 from tornado import stack_context
@@ -277,7 +277,7 @@ def _make_coroutine_wrapper(func, replace_callback):
 
     @functools.wraps(wrapped)
     def wrapper(*args, **kwargs):
-        future = TracebackFuture()
+        future = Future()
 
         if replace_callback and 'callback' in kwargs:
             callback = kwargs.pop('callback')
@@ -302,7 +302,7 @@ def _make_coroutine_wrapper(func, replace_callback):
                     orig_stack_contexts = stack_context._state.contexts
                     yielded = next(result)
                     if stack_context._state.contexts is not orig_stack_contexts:
-                        yielded = TracebackFuture()
+                        yielded = Future()
                         yielded.set_exception(
                             stack_context.StackContextInconsistentError(
                                 'stack_context inconsistency (probably caused '
@@ -456,7 +456,7 @@ class WaitIterator(object):
         Note that this `.Future` will not be the same object as any of
         the inputs.
         """
-        self._running_future = TracebackFuture()
+        self._running_future = Future()
 
         if self._finished:
             self._return_result(self._finished.popleft())
@@ -973,7 +973,7 @@ class Runner(object):
     Maintains information about pending callbacks and their results.
 
     The results of the generator are stored in ``result_future`` (a
-    `.TracebackFuture`)
+    `.Future`)
     """
     def __init__(self, gen, result_future, first_yielded):
         self.gen = gen
@@ -1104,7 +1104,7 @@ class Runner(object):
         if isinstance(yielded, YieldPoint):
             # YieldPoints are too closely coupled to the Runner to go
             # through the generic convert_yielded mechanism.
-            self.future = TracebackFuture()
+            self.future = Future()
 
             def start_yield_point():
                 try:
index 05c62081ae00245f709c6814b7abe3f9879c7594..1dea202e558e3cc885073a1ad02ba95393a8b725 100644 (file)
@@ -44,7 +44,7 @@ import functools
 import time
 import weakref
 
-from tornado.concurrent import TracebackFuture
+from tornado.concurrent import Future
 from tornado.escape import utf8, native_str
 from tornado import gen, httputil, stack_context
 from tornado.ioloop import IOLoop
@@ -238,7 +238,7 @@ class AsyncHTTPClient(Configurable):
         # where normal dicts get converted to HTTPHeaders objects.
         request.headers = httputil.HTTPHeaders(request.headers)
         request = _RequestProxy(request, self.defaults)
-        future = TracebackFuture()
+        future = Future()
         if callback is not None:
             callback = stack_context.wrap(callback)
 
index e64009df6d1d476df7043ff95f9811bb10e196ff..fd8f369cce8597e473dcef79476f920ed8afc722 100644 (file)
@@ -44,7 +44,7 @@ import time
 import traceback
 import math
 
-from tornado.concurrent import TracebackFuture, is_future, chain_future, future_set_exc_info
+from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info
 from tornado.log import app_log, gen_log
 from tornado.platform.auto import set_close_exec, Waker
 from tornado import stack_context
@@ -481,13 +481,13 @@ class IOLoop(Configurable):
                     from tornado.gen import convert_yielded
                     result = convert_yielded(result)
             except Exception:
-                future_cell[0] = TracebackFuture()
+                future_cell[0] = Future()
                 future_set_exc_info(future_cell[0], sys.exc_info())
             else:
                 if is_future(result):
                     future_cell[0] = result
                 else:
-                    future_cell[0] = TracebackFuture()
+                    future_cell[0] = Future()
                     future_cell[0].set_result(result)
             self.add_future(future_cell[0], lambda future: self.stop())
         self.add_callback(run)
@@ -658,7 +658,7 @@ class IOLoop(Configurable):
         c_future = executor.submit(func, *args)
         # Concurrent Futures are not usable with await. Wrap this in a
         # Tornado Future instead, using self.add_future for thread-safety.
-        t_future = TracebackFuture()
+        t_future = Future()
         self.add_future(c_future, lambda f: chain_future(f, t_future))
         return t_future
 
index 2c2c358c82ac1f234337dc0c5564ade1547471fb..cede1f58580e32ddb714f845623bcbc988860041 100644 (file)
@@ -34,7 +34,7 @@ import socket
 import sys
 import re
 
-from tornado.concurrent import TracebackFuture
+from tornado.concurrent import Future
 from tornado import ioloop
 from tornado.log import gen_log, app_log
 from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, _server_ssl_defaults
@@ -395,7 +395,7 @@ class BaseIOStream(object):
             self._write_callback = stack_context.wrap(callback)
             future = None
         else:
-            future = TracebackFuture()
+            future = Future()
             future.add_done_callback(lambda f: f.exception())
             self._write_futures.append((self._total_write_index, future))
         if not self._connecting:
@@ -671,7 +671,7 @@ class BaseIOStream(object):
         if callback is not None:
             self._read_callback = stack_context.wrap(callback)
         else:
-            self._read_future = TracebackFuture()
+            self._read_future = Future()
         return self._read_future
 
     def _run_read_callback(self, size, streaming):
@@ -1091,7 +1091,7 @@ class IOStream(BaseIOStream):
             self._connect_callback = stack_context.wrap(callback)
             future = None
         else:
-            future = self._connect_future = TracebackFuture()
+            future = self._connect_future = Future()
         try:
             self.socket.connect(address)
         except socket.error as e:
@@ -1169,7 +1169,7 @@ class IOStream(BaseIOStream):
         orig_close_callback = self._close_callback
         self._close_callback = None
 
-        future = TracebackFuture()
+        future = Future()
         ssl_stream = SSLIOStream(socket, ssl_options=ssl_options)
         # Wrap the original close callback so we can fail our Future as well.
         # If we had an "unwrap" counterpart to this method we would need
@@ -1425,7 +1425,7 @@ class SSLIOStream(IOStream):
             self._ssl_connect_callback = stack_context.wrap(callback)
             future = None
         else:
-            future = self._ssl_connect_future = TracebackFuture()
+            future = self._ssl_connect_future = Future()
         if not self._ssl_accepting:
             self._run_ssl_connect_callback()
         return future
index c6804ca0aecb074d71c710ee3f38414ae7610060..1cc750d9b21b4005e7f1dc786e0cb57f349130bb 100644 (file)
@@ -28,7 +28,7 @@ import tornado.escape
 import tornado.web
 import zlib
 
-from tornado.concurrent import TracebackFuture
+from tornado.concurrent import Future
 from tornado.escape import utf8, native_str, to_unicode
 from tornado import gen, httpclient, httputil
 from tornado.ioloop import IOLoop, PeriodicCallback
@@ -1052,7 +1052,7 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection):
                  compression_options=None, ping_interval=None, ping_timeout=None,
                  max_message_size=None):
         self.compression_options = compression_options
-        self.connect_future = TracebackFuture()
+        self.connect_future = Future()
         self.protocol = None
         self.read_future = None
         self.read_queue = collections.deque()
@@ -1158,7 +1158,7 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection):
         ready.
         """
         assert self.read_future is None
-        future = TracebackFuture()
+        future = Future()
         if self.read_queue:
             future.set_result(self.read_queue.popleft())
         else: