summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-11-07 13:58:04 (GMT)
committerGitHub <noreply@github.com>2023-11-07 13:58:04 (GMT)
commitf55cb44359821e71c29903f2152b4658509dac0d (patch)
tree853f01ca01f1ab39b0bc64849296946cba1637c4 /Python
parenta077b2fbb88f5192bb47e514334f760bf08d0295 (diff)
downloadcpython-f55cb44359821e71c29903f2152b4658509dac0d.zip
cpython-f55cb44359821e71c29903f2152b4658509dac0d.tar.gz
cpython-f55cb44359821e71c29903f2152b4658509dac0d.tar.bz2
gh-106672: C API: Report indiscriminately ignored errors (GH-106674)
Functions which indiscriminately ignore all errors now report them as unraisable errors.
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 4008a28..e285232 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -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;
}