Skip to content

Commit c580a81

Browse files
authored
gh-96652: Fix faulthandler chained signal without sigaction() (#96666)
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.
1 parent 4f523a7 commit c580a81

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the faulthandler implementation of ``faulthandler.register(signal,
2+
chain=True)`` if the ``sigaction()`` function is not available: don't call
3+
the previous signal handler if it's NULL. Patch by Victor Stinner.

Modules/faulthandler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ faulthandler_user(int signum)
862862
errno = save_errno;
863863
}
864864
#else
865-
if (user->chain) {
865+
if (user->chain && user->previous != NULL) {
866866
errno = save_errno;
867867
/* call the previous signal handler */
868868
user->previous(signum);

0 commit comments

Comments
 (0)