gh-106672: C API: Report indiscriminately ignored errors (GH-106674)

Functions which indiscriminately ignore all errors now report them as
unraisable errors.
This commit is contained in:
Serhiy Storchaka 2023-11-07 15:58:04 +02:00 committed by GitHub
parent a077b2fbb8
commit f55cb44359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 195 additions and 45 deletions

View file

@ -110,6 +110,9 @@ PySys_GetObject(const char *name)
PyObject *value = _PySys_GetObject(tstate->interp, name);
/* XXX Suppress a new exception if it was raised and restore
* the old one. */
if (_PyErr_Occurred(tstate)) {
PyErr_FormatUnraisable("Exception ignored in PySys_GetObject()");
}
_PyErr_SetRaisedException(tstate, exc);
return value;
}