mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-111178: Fix function signatures in legacy_tracing.c (#131464)
This commit is contained in:
parent
6935d96e9c
commit
0a54bd6dd7
1 changed files with 38 additions and 27 deletions
|
@ -183,9 +183,10 @@ call_trace_func(_PyLegacyEventHandler *self, PyObject *arg)
|
|||
|
||||
static PyObject *
|
||||
sys_trace_exception_func(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 3);
|
||||
PyObject *exc = args[2];
|
||||
|
@ -207,9 +208,10 @@ sys_trace_exception_func(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_start(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 2);
|
||||
return call_trace_func(self, Py_None);
|
||||
|
@ -217,9 +219,10 @@ sys_trace_start(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_throw(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 3);
|
||||
return call_trace_func(self, Py_None);
|
||||
|
@ -227,9 +230,10 @@ sys_trace_throw(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_unwind(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 3);
|
||||
return call_trace_func(self, NULL);
|
||||
|
@ -237,9 +241,10 @@ sys_trace_unwind(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_return(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(!PyErr_Occurred());
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 3);
|
||||
|
@ -251,9 +256,10 @@ sys_trace_return(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_yield(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 3);
|
||||
return call_trace_func(self, args[2]);
|
||||
|
@ -261,9 +267,10 @@ sys_trace_yield(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_instruction_func(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
assert(PyVectorcall_NARGS(nargsf) == 2);
|
||||
PyFrameObject *frame = PyEval_GetFrame();
|
||||
|
@ -313,9 +320,10 @@ trace_line(
|
|||
|
||||
static PyObject *
|
||||
sys_trace_line_func(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
if (tstate->c_tracefunc == NULL) {
|
||||
|
@ -339,9 +347,10 @@ sys_trace_line_func(
|
|||
* Handle that case here */
|
||||
static PyObject *
|
||||
sys_trace_jump_func(
|
||||
_PyLegacyEventHandler *self, PyObject *const *args,
|
||||
PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames
|
||||
) {
|
||||
_PyLegacyEventHandler *self = (_PyLegacyEventHandler*)callable;
|
||||
assert(kwnames == NULL);
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
if (tstate->c_tracefunc == NULL) {
|
||||
|
@ -513,48 +522,50 @@ setup_tracing(PyThreadState *tstate, Py_tracefunc func, PyObject *arg, PyObject
|
|||
if (!tstate->interp->sys_trace_initialized) {
|
||||
tstate->interp->sys_trace_initialized = true;
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_start, PyTrace_CALL,
|
||||
PY_MONITORING_EVENT_PY_START, PY_MONITORING_EVENT_PY_RESUME)) {
|
||||
sys_trace_start, PyTrace_CALL,
|
||||
PY_MONITORING_EVENT_PY_START,
|
||||
PY_MONITORING_EVENT_PY_RESUME)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_throw, PyTrace_CALL,
|
||||
PY_MONITORING_EVENT_PY_THROW, -1)) {
|
||||
sys_trace_throw, PyTrace_CALL,
|
||||
PY_MONITORING_EVENT_PY_THROW, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_return, PyTrace_RETURN,
|
||||
PY_MONITORING_EVENT_PY_RETURN, -1)) {
|
||||
sys_trace_return, PyTrace_RETURN,
|
||||
PY_MONITORING_EVENT_PY_RETURN, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_yield, PyTrace_RETURN,
|
||||
PY_MONITORING_EVENT_PY_YIELD, -1)) {
|
||||
sys_trace_yield, PyTrace_RETURN,
|
||||
PY_MONITORING_EVENT_PY_YIELD, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_exception_func, PyTrace_EXCEPTION,
|
||||
PY_MONITORING_EVENT_RAISE, PY_MONITORING_EVENT_STOP_ITERATION)) {
|
||||
sys_trace_exception_func, PyTrace_EXCEPTION,
|
||||
PY_MONITORING_EVENT_RAISE,
|
||||
PY_MONITORING_EVENT_STOP_ITERATION)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_line_func, PyTrace_LINE,
|
||||
PY_MONITORING_EVENT_LINE, -1)) {
|
||||
sys_trace_line_func, PyTrace_LINE,
|
||||
PY_MONITORING_EVENT_LINE, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_unwind, PyTrace_RETURN,
|
||||
PY_MONITORING_EVENT_PY_UNWIND, -1)) {
|
||||
sys_trace_unwind, PyTrace_RETURN,
|
||||
PY_MONITORING_EVENT_PY_UNWIND, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_jump_func, PyTrace_LINE,
|
||||
PY_MONITORING_EVENT_JUMP, -1)) {
|
||||
sys_trace_jump_func, PyTrace_LINE,
|
||||
PY_MONITORING_EVENT_JUMP, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (set_callbacks(PY_MONITORING_SYS_TRACE_ID,
|
||||
(vectorcallfunc)sys_trace_instruction_func, PyTrace_OPCODE,
|
||||
PY_MONITORING_EVENT_INSTRUCTION, -1)) {
|
||||
sys_trace_instruction_func, PyTrace_OPCODE,
|
||||
PY_MONITORING_EVENT_INSTRUCTION, -1)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue