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 index 0000000000000000000000000000000000000000..1d04db7b2a2531154ce941b615a91c036446ba3d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-09-07-22-49-37.gh-issue-96652.YqOKxI.rst @@ -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. diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 3026bb6a3432aaa4e983ca44eae6ccb748906e37..4847c1cb87bc8e035778c3bd80f1fb8bb8cf5b28 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -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);