]> granicus.if.org Git - python/commitdiff
Change the signal finialization so that it also resets the signal
authorGuido van Rossum <guido@python.org>
Mon, 3 Nov 1997 21:53:55 +0000 (21:53 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 3 Nov 1997 21:53:55 +0000 (21:53 +0000)
handlers.  After this has been called, our signal handlers are no
longer active!

Modules/signalmodule.c

index 2b4e5c3fb1f1058e8a938f7bf0a2d2c5b9c1428b..e8154925278b4b6c9217b253d199a0c535df087c 100644 (file)
@@ -513,13 +513,19 @@ static void
 finisignal()
 {
        int i;
+       PyObject *func;
 
        signal(SIGINT, old_siginthandler);
+       old_siginthandler = SIG_DFL;
 
        for (i = 1; i < NSIG; i++) {
+               func = Handlers[i].func;
                Handlers[i].tripped = 0;
-               Py_XDECREF(Handlers[i].func);
                Handlers[i].func = NULL;
+               if (i != SIGINT && func != NULL && func != Py_None &&
+                   func != DefaultHandler && func != IgnoreHandler)
+                       signal(i, SIG_DFL);
+               Py_XDECREF(func);
        }
 
        Py_XDECREF(IntHandler);