diff options
author | Mark Shannon <mark@hotpy.org> | 2023-07-27 12:32:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 12:32:30 (GMT) |
commit | 766d2518ae8384c6bd7f82727defeb86847ccf64 (patch) | |
tree | 1831ee92ae897c8236517ede9e860ab26656df3f /Python/bytecodes.c | |
parent | f84d77b4e07aeb6241c1ff9932627d3ba059efa8 (diff) | |
download | cpython-766d2518ae8384c6bd7f82727defeb86847ccf64.zip cpython-766d2518ae8384c6bd7f82727defeb86847ccf64.tar.gz cpython-766d2518ae8384c6bd7f82727defeb86847ccf64.tar.bz2 |
GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291)
* Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 0f1e007..da9d8e2 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -720,7 +720,11 @@ dummy_func( exc = args[0]; /* fall through */ case 0: - ERROR_IF(do_raise(tstate, exc, cause), exception_unwind); + if (do_raise(tstate, exc, cause)) { + assert(oparg == 0); + monitor_reraise(tstate, frame, next_instr-1); + goto exception_unwind; + } break; default: _PyErr_SetString(tstate, PyExc_SystemError, @@ -1047,6 +1051,7 @@ dummy_func( assert(exc && PyExceptionInstance_Check(exc)); Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); + monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } @@ -1058,6 +1063,7 @@ dummy_func( else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); + monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } } @@ -1072,6 +1078,7 @@ dummy_func( } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); + monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } } |