Skip to content

Commit

Permalink
tcfl/tc.py threaded did not raise e correctly
Browse files Browse the repository at this point in the history
run_for_each_target_threaded raise exception incorrectly.
we get `exception` from sys.exc_info(), which returns the old-style
representation of the handled exception, looks something like
`(type(e), e, e.__traceback__)`.
we only care on raising `e` -- the exception value -- because it has
all needed info. So we take #1.

Signed-off-by: benjamin santana <[email protected]>
  • Loading branch information
bsantana-intc committed Nov 28, 2022
1 parent 4387152 commit 8f8c8f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tcfl/tc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6290,7 +6290,12 @@ def run_for_each_target_threaded(
for role, thread in threads.items():
result, exception = thread.get()
if exception and re_raise_exceptions:
raise ( exception[0], exception[1], exception[2] )
# we get `exception` from sys.exc_info(), which returns the
# old-style representation of the handled exception,
# looks something like `(type(e), e, e.__traceback__)`.
# we only care on raising `e` -- the exception value -- because
# it has all needed info. So we take #1.
raise exception[1]
results[role] = ( result, exception )
return results

Expand Down

0 comments on commit 8f8c8f8

Please sign in to comment.