summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-11-28 16:46:23 (GMT)
committerGitHub <noreply@github.com>2019-11-28 16:46:23 (GMT)
commitb74a6f14b94d36fb72b1344663e81776bf450847 (patch)
treec02fcc9ccb6ec32da2b9f7adcf776285c405f16e /Python/sysmodule.c
parent18d8edbbb6626ac9cdf1152a720811beb2230b33 (diff)
downloadcpython-b74a6f14b94d36fb72b1344663e81776bf450847.zip
cpython-b74a6f14b94d36fb72b1344663e81776bf450847.tar.gz
cpython-b74a6f14b94d36fb72b1344663e81776bf450847.tar.bz2
bpo-38920: Add audit hooks for when sys.excepthook and sys.unraisablehook are invoked (GH-17392)
Also fixes some potential segfaults in unraisable hook handling.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 5b0fb81..1255665 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -293,8 +293,8 @@ PySys_AddAuditHook(Py_AuditHookFunction hook, void *userData)
/* Cannot invoke hooks until we are initialized */
if (Py_IsInitialized()) {
if (PySys_Audit("sys.addaudithook", NULL) < 0) {
- if (PyErr_ExceptionMatches(PyExc_Exception)) {
- /* We do not report errors derived from Exception */
+ if (PyErr_ExceptionMatches(PyExc_RuntimeError)) {
+ /* We do not report errors derived from RuntimeError */
PyErr_Clear();
return 0;
}