https://github.com/python/cpython/commit/0a54bd6dd7cda3b9611bf33652184c477a332c7e
commit: 0a54bd6dd7cda3b9611bf33652184c477a332c7e
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-03-19T16:54:41+01:00
summary:

gh-111178: Fix function signatures in legacy_tracing.c (#131464)

files:
M Python/legacy_tracing.c

diff --git a/Python/legacy_tracing.c b/Python/legacy_tracing.c
index 124b219ea8af97..0515e9bedeeacc 100644
--- a/Python/legacy_tracing.c
+++ b/Python/legacy_tracing.c
@@ -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;
         }
     }

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to