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.
This commit is contained in:
parent
356c878fbf
commit
f6a5850782
|
@ -0,0 +1,2 @@
|
|||
If :c:func:`PySys_Audit` fails in :c:func:`PyEval_SetProfile` or
|
||||
:c:func:`PyEval_SetTrace`, log the error as an unraisable exception.
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue