summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-27 12:32:30 (GMT)
committerGitHub <noreply@github.com>2023-07-27 12:32:30 (GMT)
commit766d2518ae8384c6bd7f82727defeb86847ccf64 (patch)
tree1831ee92ae897c8236517ede9e860ab26656df3f /Python/ceval.c
parentf84d77b4e07aeb6241c1ff9932627d3ba059efa8 (diff)
downloadcpython-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/ceval.c')
-rw-r--r--Python/ceval.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 688c019..a5d37c0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -184,6 +184,9 @@ lltrace_resume_frame(_PyInterpreterFrame *frame)
static void monitor_raise(PyThreadState *tstate,
_PyInterpreterFrame *frame,
_Py_CODEUNIT *instr);
+static void monitor_reraise(PyThreadState *tstate,
+ _PyInterpreterFrame *frame,
+ _Py_CODEUNIT *instr);
static int monitor_stop_iteration(PyThreadState *tstate,
_PyInterpreterFrame *frame,
_Py_CODEUNIT *instr);
@@ -840,7 +843,6 @@ error:
}
}
monitor_raise(tstate, frame, next_instr-1);
-
exception_unwind:
{
/* We can't use frame->f_lasti here, as RERAISE may have set it */
@@ -1954,6 +1956,16 @@ monitor_raise(PyThreadState *tstate, _PyInterpreterFrame *frame,
do_monitor_exc(tstate, frame, instr, PY_MONITORING_EVENT_RAISE);
}
+static void
+monitor_reraise(PyThreadState *tstate, _PyInterpreterFrame *frame,
+ _Py_CODEUNIT *instr)
+{
+ if (no_tools_for_event(tstate, frame, PY_MONITORING_EVENT_RERAISE)) {
+ return;
+ }
+ do_monitor_exc(tstate, frame, instr, PY_MONITORING_EVENT_RERAISE);
+}
+
static int
monitor_stop_iteration(PyThreadState *tstate, _PyInterpreterFrame *frame,
_Py_CODEUNIT *instr)