]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96652: Fix faulthandler chained signal without sigaction() (#96666)
authorVictor Stinner <vstinner@python.org>
Thu, 8 Sep 2022 10:20:22 +0000 (12:20 +0200)
committerGitHub <noreply@github.com>
Thu, 8 Sep 2022 10:20:22 +0000 (12:20 +0200)
Fix the faulthandler implementation of faulthandler.register(signal,
chain=True) if the sigaction() function is not available: don't call
the previous signal handler if it's NULL.

Misc/NEWS.d/next/Library/2022-09-07-22-49-37.gh-issue-96652.YqOKxI.rst [new file with mode: 0644]
Modules/faulthandler.c

diff --git a/Misc/NEWS.d/next/Library/2022-09-07-22-49-37.gh-issue-96652.YqOKxI.rst b/Misc/NEWS.d/next/Library/2022-09-07-22-49-37.gh-issue-96652.YqOKxI.rst
new file mode 100644 (file)
index 0000000..1d04db7
--- /dev/null
@@ -0,0 +1,3 @@
+Fix the faulthandler implementation of ``faulthandler.register(signal,
+chain=True)`` if the ``sigaction()`` function is not available: don't call
+the previous signal handler if it's NULL. Patch by Victor Stinner.
index b36268782bda9ff4b2ab9122b32fef6d21bbc069..8b5cf276afc1dca183c33cf5dc1c32e041c1a2e5 100644 (file)
@@ -862,7 +862,7 @@ faulthandler_user(int signum)
         errno = save_errno;
     }
 #else
-    if (user->chain) {
+    if (user->chain && user->previous != NULL) {
         errno = save_errno;
         /* call the previous signal handler */
         user->previous(signum);