diff options
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 2be02a1..d79a239 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -18,6 +18,7 @@ #include "pycore_pyerrors.h" #include "pycore_pylifecycle.h" #include "pycore_pystate.h" +#include "pycore_sysmodule.h" #include "pycore_tupleobject.h" #include "code.h" @@ -4693,9 +4694,10 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) /* The caller must hold the GIL */ assert(PyGILState_Check()); - /* Call PySys_Audit() in the context of the current thread state, + /* Call _PySys_Audit() in the context of the current thread state, even if tstate is not the current thread state. */ - if (PySys_Audit("sys.setprofile", NULL) < 0) { + PyThreadState *current_tstate = _PyThreadState_GET(); + if (_PySys_Audit(current_tstate, "sys.setprofile", NULL) < 0) { return -1; } @@ -4721,7 +4723,7 @@ PyEval_SetProfile(Py_tracefunc func, PyObject *arg) { PyThreadState *tstate = _PyThreadState_GET(); if (_PyEval_SetProfile(tstate, func, arg) < 0) { - /* Log PySys_Audit() error */ + /* Log _PySys_Audit() error */ _PyErr_WriteUnraisableMsg("in PyEval_SetProfile", NULL); } } @@ -4733,9 +4735,10 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) /* The caller must hold the GIL */ assert(PyGILState_Check()); - /* Call PySys_Audit() in the context of the current thread state, + /* Call _PySys_Audit() in the context of the current thread state, even if tstate is not the current thread state. */ - if (PySys_Audit("sys.settrace", NULL) < 0) { + PyThreadState *current_tstate = _PyThreadState_GET(); + if (_PySys_Audit(current_tstate, "sys.settrace", NULL) < 0) { return -1; } @@ -4765,7 +4768,7 @@ PyEval_SetTrace(Py_tracefunc func, PyObject *arg) { PyThreadState *tstate = _PyThreadState_GET(); if (_PyEval_SetTrace(tstate, func, arg) < 0) { - /* Log PySys_Audit() error */ + /* Log _PySys_Audit() error */ _PyErr_WriteUnraisableMsg("in PyEval_SetTrace", NULL); } } @@ -4790,7 +4793,7 @@ _PyEval_SetAsyncGenFirstiter(PyObject *firstiter) { PyThreadState *tstate = _PyThreadState_GET(); - if (PySys_Audit("sys.set_asyncgen_hook_firstiter", NULL) < 0) { + if (_PySys_Audit(tstate, "sys.set_asyncgen_hook_firstiter", NULL) < 0) { return -1; } @@ -4811,7 +4814,7 @@ _PyEval_SetAsyncGenFinalizer(PyObject *finalizer) { PyThreadState *tstate = _PyThreadState_GET(); - if (PySys_Audit("sys.set_asyncgen_hook_finalizer", NULL) < 0) { + if (_PySys_Audit(tstate, "sys.set_asyncgen_hook_finalizer", NULL) < 0) { return -1; } |