mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +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
|
@ -647,7 +647,7 @@ _PyModule_ClearDict(PyObject *d)
|
|||
PyErr_Clear();
|
||||
}
|
||||
if (PyDict_SetItem(d, key, Py_None) != 0) {
|
||||
PyErr_WriteUnraisable(NULL);
|
||||
PyErr_FormatUnraisable("Exception ignored on clearing module dict");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ _PyModule_ClearDict(PyObject *d)
|
|||
PyErr_Clear();
|
||||
}
|
||||
if (PyDict_SetItem(d, key, Py_None) != 0) {
|
||||
PyErr_WriteUnraisable(NULL);
|
||||
PyErr_FormatUnraisable("Exception ignored on clearing module dict");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -902,10 +902,9 @@ module_clear(PyModuleObject *m)
|
|||
{
|
||||
int res = m->md_def->m_clear((PyObject*)m);
|
||||
if (PyErr_Occurred()) {
|
||||
PySys_FormatStderr("Exception ignored in m_clear of module%s%V\n",
|
||||
m->md_name ? " " : "",
|
||||
m->md_name, "");
|
||||
PyErr_WriteUnraisable(NULL);
|
||||
PyErr_FormatUnraisable("Exception ignored in m_clear of module%s%V",
|
||||
m->md_name ? " " : "",
|
||||
m->md_name, "");
|
||||
}
|
||||
if (res)
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue