diff options
author | Antoine Pitrou <pitrou@free.fr> | 2018-06-03 20:46:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-03 20:46:43 +0200 |
commit | ded666ff0ce44785a495ff89b676ca68e4cc08e8 (patch) | |
tree | af307c038871b33d08a3c5d0c7106caec5765fb7 /Modules | |
parent | 9b5c9488c77aeaddeafa7e2302bdc87dd77ac084 (diff) | |
download | cpython-git-ded666ff0ce44785a495ff89b676ca68e4cc08e8.tar.gz |
[2.7] bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146) (GH-7347)
(cherry picked from commit e905c84494526363086f66a979e317e155bf9536)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/signalmodule.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index ef70d10bb1..8628f7a800 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -95,13 +95,6 @@ static PyObject *DefaultHandler; static PyObject *IgnoreHandler; static PyObject *IntHandler; -/* On Solaris 8, gcc will produce a warning that the function - declaration is not a prototype. This is caused by the definition of - SIG_DFL as (void (*)())0; the correct declaration would have been - (void (*)(int))0. */ - -static PyOS_sighandler_t old_siginthandler = SIG_DFL; - #ifdef HAVE_GETITIMER static PyObject *ItimerError; @@ -629,7 +622,7 @@ initsignal(void) /* Install default int handler */ Py_INCREF(IntHandler); Py_SETREF(Handlers[SIGINT].func, IntHandler); - old_siginthandler = PyOS_setsig(SIGINT, signal_handler); + PyOS_setsig(SIGINT, signal_handler); } #ifdef SIGHUP @@ -872,14 +865,11 @@ finisignal(void) int i; PyObject *func; - PyOS_setsig(SIGINT, old_siginthandler); - old_siginthandler = SIG_DFL; - for (i = 1; i < NSIG; i++) { func = Handlers[i].func; Handlers[i].tripped = 0; Handlers[i].func = NULL; - if (i != SIGINT && func != NULL && func != Py_None && + if (func != NULL && func != Py_None && func != DefaultHandler && func != IgnoreHandler) PyOS_setsig(i, SIG_DFL); Py_XDECREF(func); |