summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/faulthandler.rst3
-rw-r--r--Modules/faulthandler.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst
index 106da45..c0b6625 100644
--- a/Doc/library/faulthandler.rst
+++ b/Doc/library/faulthandler.rst
@@ -97,7 +97,8 @@ Dump the traceback on a user signal
.. function:: unregister(signum)
Unregister a user signal: uninstall the handler of the *signum* signal
- installed by :func:`register`.
+ installed by :func:`register`. Return ``True`` if the signal was registered,
+ ``False`` otherwise.
Not available on Windows.
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 76cadf3..1132036 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -694,6 +694,9 @@ faulthandler_unregister_py(PyObject *self, PyObject *args)
if (!check_signum(signum))
return NULL;
+ if (user_signals == NULL)
+ Py_RETURN_FALSE;
+
user = &user_signals[signum];
change = faulthandler_unregister(user, signum);
return PyBool_FromLong(change);