self.assertIn(r0, ("raise", "reraise"))
h0 = h[0]
self.assertIn(h0, ("handled", "unwind"))
-
+ self.assertEqual(r[1], h[1])
class StopiterationRecorder(ExceptionRecorder):
event_type = E.PY_UNWIND
- def __call__(self, *args):
- self.events.append(("unwind", None))
+ def __call__(self, code, offset, exc):
+ self.events.append(("unwind", type(exc)))
class ExceptionHandledRecorder(ExceptionRecorder):
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);
}
return call_profile_func(self, args[2]);
}
+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,
return call_trace_func(self, Py_None);
}
+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,
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;
}
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;
}