]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix double logging of exceptions with both @asynchronous and @coroutine.
authorBen Darnell <ben@bendarnell.com>
Sun, 13 Oct 2013 21:07:18 +0000 (17:07 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 13 Oct 2013 21:07:18 +0000 (17:07 -0400)
Tornado 3.1 made the @asynchronous decorator optional when @coroutine
is used, but if it was used anyway both @asynchronous and the new code
would log any uncaught exceptions.

tornado/web.py

index b820d9645981bb9aa330ce7d27f1d763a53b3f41..ddc10b8932f6d9047bd5dcce630b2e18481cf854 100644 (file)
@@ -1369,6 +1369,12 @@ def asynchronous(method):
                     if not self._finished:
                         self.finish()
                 IOLoop.current().add_future(result, future_complete)
+                # Once we have done this, hide the Future from our
+                # caller (i.e. RequestHandler._when_complete), which
+                # would otherwise set up its own callback and
+                # exception handler (resulting in exceptions being
+                # logged twice).
+                return None
             return result
     return wrapper