mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-117459: Keep the traceback in _convert_future_exc (#117460)
This commit is contained in:
parent
b4fe02f595
commit
85843348c5
3 changed files with 22 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue