summaryrefslogtreecommitdiffstats
path: root/Python/legacy_tracing.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-28 10:30:16 (GMT)
committerGitHub <noreply@github.com>2023-07-28 10:30:16 (GMT)
commit3f167de440f65eb03f795e33b98cf3e84627e213 (patch)
treed80aabd7204b502a3d6a4d557cebfb5dc7b81268 /Python/legacy_tracing.c
parent0902afbae29ef88bf9d212a7e11f9f17b6cbdeb5 (diff)
downloadcpython-3f167de440f65eb03f795e33b98cf3e84627e213.zip
cpython-3f167de440f65eb03f795e33b98cf3e84627e213.tar.gz
cpython-3f167de440f65eb03f795e33b98cf3e84627e213.tar.bz2
[3.12] GH-106898: Add the exception as an argument to the `PY_UNWIND` event callback function. (GH-107347) (GH-107382)
Diffstat (limited to 'Python/legacy_tracing.c')
-rw-r--r--Python/legacy_tracing.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/Python/legacy_tracing.c b/Python/legacy_tracing.c
index 5143b79..c1c70f6 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
@@ -363,7 +383,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;
}
@@ -451,7 +471,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;
}