# error "this header file must not be included directly"
#endif
-PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
-
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate);
#endif
+// Used by sys.call_tracing()
+extern PyObject* _PyEval_CallTracing(PyObject *func, PyObject *args);
+
// Used by sys.get_asyncgen_hooks()
extern PyObject* _PyEval_GetAsyncGenFirstiter(void);
extern PyObject* _PyEval_GetAsyncGenFinalizer(void);
--- /dev/null
+Remove the private undocumented function ``_PyEval_CallTracing()`` from the
+C API. Call the public :func:`sys.call_tracing` function instead. Patch by
+Victor Stinner.
return result;
}
-PyObject *
+PyObject*
_PyEval_CallTracing(PyObject *func, PyObject *args)
{
+ // Save and disable tracing
PyThreadState *tstate = _PyThreadState_GET();
int save_tracing = tstate->tracing;
int save_use_tracing = tstate->cframe->use_tracing;
- PyObject *result;
-
tstate->tracing = 0;
- result = PyObject_Call(func, args, NULL);
+
+ // Call the tracing function
+ PyObject *result = PyObject_Call(func, args, NULL);
+
+ // Restore tracing
tstate->tracing = save_tracing;
tstate->cframe->use_tracing = save_use_tracing;
return result;