Index: Modules/signalmodule.c =================================================================== --- Modules/signalmodule.c (revision 53537) +++ Modules/signalmodule.c (working copy) @@ -75,7 +75,8 @@ PyObject *func; } Handlers[NSIG]; -static int is_tripped = 0; /* Speed up sigcheck() when none tripped */ +/* Speed up sigcheck() when none tripped */ +static volatile sig_atomic_t is_tripped = 0; static PyObject *DefaultHandler; static PyObject *IgnoreHandler; @@ -122,7 +123,7 @@ /* See NOTES section above */ if (getpid() == main_pid) { #endif - is_tripped++; + is_tripped = 1; Handlers[sig_num].tripped = 1; Py_AddPendingCall(checksignals_witharg, NULL); #ifdef WITH_THREAD @@ -597,13 +598,16 @@ if (!is_tripped) return 0; + is_tripped = 0; + #ifdef WITH_THREAD if (PyThread_get_thread_ident() != main_thread) return 0; #endif + if (!(f = (PyObject *)PyEval_GetFrame())) f = Py_None; - + for (i = 1; i < NSIG; i++) { if (Handlers[i].tripped) { PyObject *result = NULL; @@ -621,7 +625,7 @@ Py_DECREF(result); } } - is_tripped = 0; + return 0; } @@ -632,7 +636,7 @@ void PyErr_SetInterrupt(void) { - is_tripped++; + is_tripped = 1; Handlers[SIGINT].tripped = 1; Py_AddPendingCall((int (*)(void *))PyErr_CheckSignals, NULL); }