diff --git a/tornado/gen.py b/tornado/gen.py index 7bfbaf012c..313740503f 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -221,7 +221,7 @@ def wrapper(*args, **kwargs): result = ctx_run(func, *args, **kwargs) except (Return, StopIteration) as e: result = _value_from_stopiteration(e) - except Exception: + except (Exception, asyncio.CancelledError): future_set_exc_info(future, sys.exc_info()) try: return future @@ -241,7 +241,7 @@ def wrapper(*args, **kwargs): future_set_result_unless_cancelled( future, _value_from_stopiteration(e) ) - except Exception: + except (Exception, asyncio.CancelledError): future_set_exc_info(future, sys.exc_info()) else: # Provide strong references to Runner objects as long