Skip to content

Commit 046255c

Browse files
authored
bpo-35370: PyEval_SetTrace() logs unraisable error (GH-18977) (GH-19029)
If PySys_Audit() fails in PyEval_SetProfile() or PyEval_SetTrace(), log the error as an unraisable exception. (cherry picked from commit f6a5850)
1 parent 7f5302f commit 046255c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
If :c:func:`PySys_Audit` fails in :c:func:`PyEval_SetProfile` or
2+
:c:func:`PyEval_SetTrace`, log the error as an unraisable exception.

‎Python/ceval.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4686,6 +4686,7 @@ void
46864686
PyEval_SetProfile(Py_tracefunc func, PyObject *arg)
46874687
{
46884688
if (PySys_Audit("sys.setprofile", NULL) < 0) {
4689+
_PyErr_WriteUnraisableMsg("in PyEval_SetProfile", NULL);
46894690
return;
46904691
}
46914692

@@ -4707,6 +4708,7 @@ void
47074708
PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
47084709
{
47094710
if (PySys_Audit("sys.settrace", NULL) < 0) {
4711+
_PyErr_WriteUnraisableMsg("in PyEval_SetTrace", NULL);
47104712
return;
47114713
}
47124714

0 commit comments

Comments
 (0)