]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
concurrent: Remove some pre-6.0 compatibility code 2545/head
authorBen Darnell <ben@bendarnell.com>
Sun, 2 Dec 2018 18:19:57 +0000 (13:19 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 2 Dec 2018 18:19:57 +0000 (13:19 -0500)
tornado/concurrent.py

index e25f3454c80b4fad1e3995288aafbd65911e439c..df12da87f0b6218a5cf1944d5dddf654e192c207 100644 (file)
@@ -217,8 +217,8 @@ def future_set_exc_info(
 ) -> None:
     """Set the given ``exc_info`` as the `Future`'s exception.
 
-    Understands both `asyncio.Future` and Tornado's extensions to
-    enable better tracebacks on Python 2.
+    Understands both `asyncio.Future` and the extensions in older
+    versions of Tornado to enable better tracebacks on Python 2.
 
     .. versionadded:: 5.0
 
@@ -228,14 +228,9 @@ def future_set_exc_info(
        (previously asyncio.InvalidStateError would be raised)
 
     """
-    if hasattr(future, "set_exc_info"):
-        # Tornado's Future
-        future.set_exc_info(exc_info)  # type: ignore
-    else:
-        # asyncio.Future
-        if exc_info[1] is None:
-            raise Exception("future_set_exc_info called with no exception")
-        future_set_exception_unless_cancelled(future, exc_info[1])
+    if exc_info[1] is None:
+        raise Exception("future_set_exc_info called with no exception")
+    future_set_exception_unless_cancelled(future, exc_info[1])
 
 
 @typing.overload