Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ What's New in Python 2.7.14?
Core and Builtins
-----------------

- bpo-30654: Fixed reset of the SIGINT handler to SIG_DFL on interpreter
shutdown even when there was a custom handler set previously. Patch by
Philipp Kerling.

- bpo-27945: Fixed various segfaults with dict when input collections are
mutated during searching, inserting or comparing. Based on patches by
Duane Griffin and Tim Mitchell.
Expand Down
14 changes: 2 additions & 12 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -622,7 +615,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
Expand Down Expand Up @@ -865,14 +858,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);
Expand Down