diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-11-02 11:16:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 09:16:34 +0000 |
commit | 970e719a7a829bddc647bbaa668dd8603abdddef (patch) | |
tree | 92eeeba01687f6e02482315db653ce57f3b10e4b /Python/import.c | |
parent | a12f624a9dc1c44bb20a20b13fd164c14b987892 (diff) | |
download | cpython-970e719a7a829bddc647bbaa668dd8603abdddef.tar.gz cpython-970e719a7a829bddc647bbaa668dd8603abdddef.zip |
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>
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/import.c b/Python/import.c index 9aee7aa0e4d..b6ffba5c574 100644 --- a/Python/import.c +++ b/Python/import.c @@ -584,7 +584,7 @@ _PyImport_ClearModulesByIndex(PyInterpreterState *interp) if (PyList_SetSlice(MODULES_BY_INDEX(interp), 0, PyList_GET_SIZE(MODULES_BY_INDEX(interp)), NULL)) { - PyErr_WriteUnraisable(MODULES_BY_INDEX(interp)); + PyErr_FormatUnraisable("Exception ignored on clearing interpreters module list"); } } @@ -3156,13 +3156,13 @@ _PyImport_FiniCore(PyInterpreterState *interp) int verbose = _PyInterpreterState_GetConfig(interp)->verbose; if (_PySys_ClearAttrString(interp, "meta_path", verbose) < 0) { - PyErr_WriteUnraisable(NULL); + PyErr_FormatUnraisable("Exception ignored on clearing sys.meta_path"); } // XXX Pull in most of finalize_modules() in pylifecycle.c. if (_PySys_ClearAttrString(interp, "modules", verbose) < 0) { - PyErr_WriteUnraisable(NULL); + PyErr_FormatUnraisable("Exception ignored on clearing sys.modules"); } if (IMPORT_LOCK(interp) != NULL) { @@ -3242,10 +3242,10 @@ _PyImport_FiniExternal(PyInterpreterState *interp) // XXX Uninstall importlib metapath importers here? if (_PySys_ClearAttrString(interp, "path_importer_cache", verbose) < 0) { - PyErr_WriteUnraisable(NULL); + PyErr_FormatUnraisable("Exception ignored on clearing sys.path_importer_cache"); } if (_PySys_ClearAttrString(interp, "path_hooks", verbose) < 0) { - PyErr_WriteUnraisable(NULL); + PyErr_FormatUnraisable("Exception ignored on clearing sys.path_hooks"); } } |