mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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:
parent
a12f624a9d
commit
970e719a7a
18 changed files with 83 additions and 114 deletions
|
@ -133,7 +133,6 @@ any DWARF information available for them).
|
|||
#include "pycore_ceval.h" // _PyPerf_Callbacks
|
||||
#include "pycore_frame.h"
|
||||
#include "pycore_interp.h"
|
||||
#include "pycore_pyerrors.h" // _PyErr_WriteUnraisableMsg()
|
||||
|
||||
|
||||
#ifdef PY_HAVE_PERF_TRAMPOLINE
|
||||
|
@ -236,8 +235,7 @@ new_code_arena(void)
|
|||
0); // offset (not used here)
|
||||
if (!memory) {
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
_PyErr_WriteUnraisableMsg(
|
||||
"Failed to create new mmap for perf trampoline", NULL);
|
||||
PyErr_FormatUnraisable("Failed to create new mmap for perf trampoline");
|
||||
perf_status = PERF_STATUS_FAILED;
|
||||
return -1;
|
||||
}
|
||||
|
@ -261,9 +259,8 @@ new_code_arena(void)
|
|||
if (res == -1) {
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
munmap(memory, mem_size);
|
||||
_PyErr_WriteUnraisableMsg(
|
||||
"Failed to set mmap for perf trampoline to PROT_READ | PROT_EXEC",
|
||||
NULL);
|
||||
PyErr_FormatUnraisable("Failed to set mmap for perf trampoline to "
|
||||
"PROT_READ | PROT_EXEC");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -277,8 +274,7 @@ new_code_arena(void)
|
|||
if (new_arena == NULL) {
|
||||
PyErr_NoMemory();
|
||||
munmap(memory, mem_size);
|
||||
_PyErr_WriteUnraisableMsg("Failed to allocate new code arena struct",
|
||||
NULL);
|
||||
PyErr_FormatUnraisable("Failed to allocate new code arena struct for perf trampoline");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue