diff options
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r-- | Modules/signalmodule.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 5a6c777fb5..32cd8bbece 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -4,7 +4,6 @@ /* XXX Signals should be recorded per thread, now we have thread state. */ #include "Python.h" -#include "intrcheck.h" #ifdef MS_WINDOWS #include <Windows.h> @@ -13,9 +12,12 @@ #endif #endif +#ifdef HAVE_SIGNAL_H #include <signal.h> - +#endif +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> +#endif #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif @@ -841,6 +843,18 @@ PyInit_signal(void) PyDict_SetItemString(d, "ItimerError", ItimerError); #endif +#ifdef CTRL_C_EVENT + x = PyLong_FromLong(CTRL_C_EVENT); + PyDict_SetItemString(d, "CTRL_C_EVENT", x); + Py_DECREF(x); +#endif + +#ifdef CTRL_BREAK_EVENT + x = PyLong_FromLong(CTRL_BREAK_EVENT); + PyDict_SetItemString(d, "CTRL_BREAK_EVENT", x); + Py_DECREF(x); +#endif + if (PyErr_Occurred()) { Py_DECREF(m); m = NULL; @@ -948,7 +962,7 @@ PyOS_InitInterrupts(void) { PyObject *m = PyInit_signal(); if (m) { - _PyImport_FixupExtension(m, "signal", "signal"); + _PyImport_FixupBuiltin(m, "signal"); Py_DECREF(m); } } @@ -977,10 +991,13 @@ void PyOS_AfterFork(void) { #ifdef WITH_THREAD + /* PyThread_ReInitTLS() must be called early, to make sure that the TLS API + * can be called safely. */ + PyThread_ReInitTLS(); + _PyGILState_Reinit(); PyEval_ReInitThreads(); main_thread = PyThread_get_thread_ident(); main_pid = getpid(); _PyImport_ReInitLock(); - PyThread_ReInitTLS(); #endif } |