summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-03-21 02:03:22 (GMT)
committerGitHub <noreply@github.com>2022-03-21 02:03:22 (GMT)
commite63894b3eed8ad2dd7690695f7f07bfbff59c05a (patch)
tree9f94d5ec7bce674f6be5384fa5933f4fae1221c5 /Python/ceval.c
parent9087243e2c167e38570e819b228efc3492c38c9c (diff)
downloadcpython-e63894b3eed8ad2dd7690695f7f07bfbff59c05a.zip
cpython-e63894b3eed8ad2dd7690695f7f07bfbff59c05a.tar.gz
cpython-e63894b3eed8ad2dd7690695f7f07bfbff59c05a.tar.bz2
bpo-46850: Remove _PyEval_CallTracing() function (GH-32019)
Remove the private undocumented function _PyEval_CallTracing() from the C API. Call the public sys.call_tracing() function instead.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 04f2dde..6f449e3 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -6708,16 +6708,19 @@ call_trace(Py_tracefunc func, PyObject *obj,
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;