Skip to content

Commit 3ae2be6

Browse files
gh-96652: Fix faulthandler chained signal without sigaction() (GH-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. (cherry picked from commit c580a81) Co-authored-by: Victor Stinner <[email protected]>
1 parent 6ee7a6b commit 3ae2be6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 3 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ faulthandler_user(int signum)
877877
errno = save_errno;
878878
}
879879
#else
880-
if (user->chain) {
880+
if (user->chain && user->previous != NULL) {
881881
errno = save_errno;
882882
/* call the previous signal handler */
883883
user->previous(signum);

0 commit comments

Comments
 (0)