summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-27 14:47:33 (GMT)
committerGitHub <noreply@github.com>2023-07-27 14:47:33 (GMT)
commitac7a0f858a8d0c6ca2e64bb880fca40e229d267a (patch)
treef9765cb1e1508018aeaa3259ef3eb431d263e6cc /Python
parent9a7204b86bdb3e26c2a62aeaafb875275500b9f7 (diff)
downloadcpython-ac7a0f858a8d0c6ca2e64bb880fca40e229d267a.zip
cpython-ac7a0f858a8d0c6ca2e64bb880fca40e229d267a.tar.gz
cpython-ac7a0f858a8d0c6ca2e64bb880fca40e229d267a.tar.bz2
GH-106898: Add the exception as an argument to the `PY_UNWIND` event callback function. (GH-107347)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
-rw-r--r--Python/legacy_tracing.c24
2 files changed, 23 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index c0b37b3..17818a0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1987,7 +1987,7 @@ monitor_unwind(PyThreadState *tstate,
if (no_tools_for_event(tstate, frame, PY_MONITORING_EVENT_PY_UNWIND)) {
return;
}
- _Py_call_instrumentation_exc0(tstate, PY_MONITORING_EVENT_PY_UNWIND, frame, instr);
+ do_monitor_exc(tstate, frame, instr, PY_MONITORING_EVENT_PY_UNWIND);
}
diff --git a/Python/legacy_tracing.c b/Python/legacy_tracing.c
index 9cc48fc..48db517 100644
--- a/Python/legacy_tracing.c
+++ b/Python/legacy_tracing.c
@@ -65,6 +65,16 @@ sys_profile_func3(
}
static PyObject *
+sys_profile_unwind(
+ _PyLegacyEventHandler *self, PyObject *const *args,
+ size_t nargsf, PyObject *kwnames
+) {
+ assert(kwnames == NULL);
+ assert(PyVectorcall_NARGS(nargsf) == 3);
+ return call_profile_func(self, Py_None);
+}
+
+static PyObject *
sys_profile_call_or_return(
_PyLegacyEventHandler *self, PyObject *const *args,
size_t nargsf, PyObject *kwnames
@@ -153,6 +163,16 @@ sys_trace_func2(
}
static PyObject *
+sys_trace_unwind(
+ _PyLegacyEventHandler *self, PyObject *const *args,
+ size_t nargsf, PyObject *kwnames
+) {
+ assert(kwnames == NULL);
+ assert(PyVectorcall_NARGS(nargsf) == 3);
+ return call_trace_func(self, Py_None);
+}
+
+static PyObject *
sys_trace_return(
_PyLegacyEventHandler *self, PyObject *const *args,
size_t nargsf, PyObject *kwnames
@@ -362,7 +382,7 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
return -1;
}
if (set_callbacks(PY_MONITORING_SYS_PROFILE_ID,
- (vectorcallfunc)sys_profile_func2, PyTrace_RETURN,
+ (vectorcallfunc)sys_profile_unwind, PyTrace_RETURN,
PY_MONITORING_EVENT_PY_UNWIND, -1)) {
return -1;
}
@@ -450,7 +470,7 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg)
return -1;
}
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
- (vectorcallfunc)sys_trace_func2, PyTrace_RETURN,
+ (vectorcallfunc)sys_trace_unwind, PyTrace_RETURN,
PY_MONITORING_EVENT_PY_UNWIND, -1)) {
return -1;
}