aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/tornado/tornado-4/patches/03-unknown.patch
blob: dfac16ddddb851adc6a6f6b25bf0fa3a4df568ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
--- contrib/python/tornado/tornado-4/tornado/gen.py	(index)
+++ contrib/python/tornado/tornado-4/tornado/gen.py	(working tree)
@@ -914,7 +914,8 @@ def with_timeout(timeout, future, io_loop=None, quiet_exceptions=()):
                               future, exc_info=True)
 
     def timeout_callback():
-        result.set_exception(TimeoutError("Timeout"))
+        if not result.done():
+            result.set_exception(TimeoutError("Timeout"))
         # In case the wrapped future goes on to fail, log it.
         future.add_done_callback(error_callback)
     timeout_handle = io_loop.add_timeout(