gh-108082: Use PyErr_FormatUnraisable() (GH-111580)

Replace most of calls of _PyErr_WriteUnraisableMsg() and some
calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable().

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Serhiy Storchaka 2023-11-02 11:16:34 +02:00 committed by GitHub
parent a12f624a9d
commit 970e719a7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 83 additions and 114 deletions

View file

@ -650,7 +650,7 @@ _PyErr_PrintEx(PyThreadState *tstate, int set_sys_last_vars)
PyErr_Clear();
goto done;
}
_PyErr_WriteUnraisableMsg("in audit hook", NULL);
PyErr_FormatUnraisable("Exception ignored in audit hook");
}
if (hook) {
PyObject* args[3] = {typ, exc, tb};
@ -1093,7 +1093,8 @@ fallback:
_PyRuntime.signals.unhandled_keyboard_interrupt = unhandled_keyboard_interrupt;
#ifdef Py_DEBUG
if (PyErr_Occurred()) {
_PyErr_WriteUnraisableMsg("in the internal traceback machinery", NULL);
PyErr_FormatUnraisable(
"Exception ignored in the internal traceback machinery");
}
#endif
PyErr_Clear();