From: Ben Darnell Date: Fri, 5 Jul 2013 17:08:44 +0000 (-0400) Subject: Use TracebackFuture for all internal Futures for better tracebacks on py2.x. X-Git-Tag: v3.2.0b1~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bc337a9e04866b861ec0ece1c1e64b3d8ff51db;p=thirdparty%2Ftornado.git Use TracebackFuture for all internal Futures for better tracebacks on py2.x. --- diff --git a/tornado/auth.py b/tornado/auth.py index 0cc707fd2..825fda417 100644 --- a/tornado/auth.py +++ b/tornado/auth.py @@ -56,7 +56,7 @@ import hmac import time import uuid -from tornado.concurrent import Future, chain_future, return_future +from tornado.concurrent import TracebackFuture, chain_future, return_future from tornado import gen from tornado import httpclient from tornado import escape @@ -99,7 +99,7 @@ def _auth_return_future(f): @functools.wraps(f) def wrapper(*args, **kwargs): - future = Future() + future = TracebackFuture() callback, args, kwargs = replacer.replace(future, args, kwargs) if callback is not None: future.add_done_callback( diff --git a/tornado/httpclient.py b/tornado/httpclient.py index a34eb66bd..b611ad95b 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -33,7 +33,7 @@ import functools import time import weakref -from tornado.concurrent import Future +from tornado.concurrent import TracebackFuture from tornado.escape import utf8 from tornado import httputil, stack_context from tornado.ioloop import IOLoop @@ -174,7 +174,7 @@ class AsyncHTTPClient(Configurable): # where normal dicts get converted to HTTPHeaders objects. request.headers = httputil.HTTPHeaders(request.headers) request = _RequestProxy(request, self.defaults) - future = Future() + future = TracebackFuture() if callback is not None: callback = stack_context.wrap(callback) diff --git a/tornado/ioloop.py b/tornado/ioloop.py index 5b0d4ee73..49e37eb95 100644 --- a/tornado/ioloop.py +++ b/tornado/ioloop.py @@ -356,7 +356,7 @@ class IOLoop(Configurable): if isinstance(result, Future): future_cell[0] = result else: - future_cell[0] = Future() + future_cell[0] = TracebackFuture() future_cell[0].set_result(result) self.add_future(future_cell[0], lambda future: self.stop()) self.add_callback(run) diff --git a/tornado/websocket.py b/tornado/websocket.py index 1eef4019b..6c3b875d2 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -31,7 +31,7 @@ import time import tornado.escape import tornado.web -from tornado.concurrent import Future +from tornado.concurrent import TracebackFuture from tornado.escape import utf8, native_str from tornado import httpclient from tornado.ioloop import IOLoop @@ -764,7 +764,7 @@ class WebSocketProtocol13(WebSocketProtocol): class WebSocketClientConnection(simple_httpclient._HTTPConnection): """WebSocket client connection.""" def __init__(self, io_loop, request): - self.connect_future = Future() + self.connect_future = TracebackFuture() self.read_future = None self.read_queue = collections.deque() self.key = base64.b64encode(os.urandom(16)) @@ -825,7 +825,7 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection): ready. """ assert self.read_future is None - future = Future() + future = TracebackFuture() if self.read_queue: future.set_result(self.read_queue.popleft()) else: