summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/futures.py
diff options
context:
space:
mode:
authorrsp4jack <rsp4jack@outlook.com>2024-04-04 03:13:32 (GMT)
committerGitHub <noreply@github.com>2024-04-04 03:13:32 (GMT)
commit85843348c5f0b8c2f973e8bc586475e69af19cd2 (patch)
treebff8b37d5662cd05f2bfaca4d54f0eb6a240947a /Lib/asyncio/futures.py
parentb4fe02f595fcb9f78261920a268ef614821ec195 (diff)
downloadcpython-85843348c5f0b8c2f973e8bc586475e69af19cd2.zip
cpython-85843348c5f0b8c2f973e8bc586475e69af19cd2.tar.gz
cpython-85843348c5f0b8c2f973e8bc586475e69af19cd2.tar.bz2
gh-117459: Keep the traceback in _convert_future_exc (#117460)
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r--Lib/asyncio/futures.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index 5d35321..9c1b5e4 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -319,11 +319,9 @@ def _set_result_unless_cancelled(fut, result):
def _convert_future_exc(exc):
exc_class = type(exc)
if exc_class is concurrent.futures.CancelledError:
- return exceptions.CancelledError(*exc.args)
- elif exc_class is concurrent.futures.TimeoutError:
- return exceptions.TimeoutError(*exc.args)
+ return exceptions.CancelledError(*exc.args).with_traceback(exc.__traceback__)
elif exc_class is concurrent.futures.InvalidStateError:
- return exceptions.InvalidStateError(*exc.args)
+ return exceptions.InvalidStateError(*exc.args).with_traceback(exc.__traceback__)
else:
return exc