Skip to content

Commit b707c0b

Browse files
committed
Actually use custom exception type
1 parent 0dee54f commit b707c0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/test/test_with_signal_safety.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def inject_exception(frame, event, arg):
2424
# TODO: Add `f_traceall` API to request tracing for every opcode
2525
# frame.f_traceall = True
2626
if frame.f_lasti >= target_instruction:
27-
raise RuntimeError(f"Failing after {target_instruction}")
27+
raise InjectedException(f"Failing after {target_instruction}")
2828
return inject_exception
2929
sys.settrace(inject_exception)
3030

@@ -82,7 +82,7 @@ def traced_function():
8282
print(f"Raising exception after {target_instruction}")
8383
try:
8484
traced_function()
85-
except RuntimeError:
85+
except InjectedException:
8686
# key invariant: if we entered the CM, we exited it
8787
self.assert_cm_exited(tracking_cm, target_instruction, traced_function)
8888
else:
@@ -112,7 +112,7 @@ async def traced_coroutine():
112112
print(f"Raising exception after {target_instruction}")
113113
try:
114114
loop.run_until_complete(traced_coroutine())
115-
except RuntimeError:
115+
except InjectedException:
116116
# key invariant: if we entered the CM, we exited it
117117
self.assert_cm_exited(tracking_cm, target_instruction, traced_coroutine)
118118
else:

0 commit comments

Comments
 (0)