Skip signal handler re-installation if it is not necessary.  Issue 8354.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 8294b91..71a53ea 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1862,6 +1862,10 @@
 PyOS_setsig(int sig, PyOS_sighandler_t handler)
 {
 #ifdef HAVE_SIGACTION
+	/* Some code in Modules/signalmodule.c depends on sigaction() being
+	 * used here if HAVE_SIGACTION is defined.  Fix that if this code
+	 * changes to invalidate that assumption.
+	 */
 	struct sigaction context, ocontext;
 	context.sa_handler = handler;
 	sigemptyset(&context.sa_mask);