diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-16 16:41:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 16:41:44 (GMT) |
commit | f6a58507820c67e8d0fb07875cd1b1d9f5e510a8 (patch) | |
tree | c9e924d2d8e90372fb523c2f42086f6fac51f327 /Python | |
parent | 356c878fbf2a97aa3ab7951fd7456d219ff0b466 (diff) | |
download | cpython-f6a58507820c67e8d0fb07875cd1b1d9f5e510a8.zip cpython-f6a58507820c67e8d0fb07875cd1b1d9f5e510a8.tar.gz cpython-f6a58507820c67e8d0fb07875cd1b1d9f5e510a8.tar.bz2 |
bpo-35370: PyEval_SetTrace() logs unraisable error (GH-18977)
If PySys_Audit() fails in PyEval_SetProfile() or PyEval_SetTrace(),
log the error as an unraisable exception.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index fc4f718..b359fb0 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4620,7 +4620,10 @@ void PyEval_SetProfile(Py_tracefunc func, PyObject *arg) { PyThreadState *tstate = _PyThreadState_GET(); - (void)_PyEval_SetProfile(tstate, func, arg); + if (_PyEval_SetProfile(tstate, func, arg) < 0) { + /* Log PySys_Audit() error */ + _PyErr_WriteUnraisableMsg("in PyEval_SetProfile", NULL); + } } int @@ -4661,7 +4664,10 @@ void PyEval_SetTrace(Py_tracefunc func, PyObject *arg) { PyThreadState *tstate = _PyThreadState_GET(); - (void)_PyEval_SetTrace(tstate, func, arg); + if (_PyEval_SetTrace(tstate, func, arg) < 0) { + /* Log PySys_Audit() error */ + _PyErr_WriteUnraisableMsg("in PyEval_SetTrace", NULL); + } } |