Issue #8407: pthread_sigmask() checks immediatly if signal handlers have been
called. The test checks that SIG_UNBLOCK calls immediatly the signal handler of
the pending SIGUSR1. Improve also the tests using an exception (division by
zero) instead of a flag (a function attribute).
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 0cb2720..387dc8c 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -573,6 +573,10 @@
         return NULL;
     }
 
+    /* if signals was unblocked, signal handlers have been called */
+    if (PyErr_CheckSignals())
+        return NULL;
+
     result = PyList_New(0);
     if (result == NULL)
         return NULL;