From: Ben Darnell Date: Sun, 13 Oct 2013 21:07:18 +0000 (-0400) Subject: Fix double logging of exceptions with both @asynchronous and @coroutine. X-Git-Tag: v3.2.0b1~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0581156eb79857d097f00444f1208a30b5b99533;p=thirdparty%2Ftornado.git Fix double logging of exceptions with both @asynchronous and @coroutine. 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. --- diff --git a/tornado/web.py b/tornado/web.py index b820d9645..ddc10b893 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -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