diff options
| author | Victor Stinner <vstinner@python.org> | 2020-11-17 21:23:18 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-17 21:23:18 (GMT) |
| commit | a702bd4b921167e73f8fc987aa64ada571fdc3f8 (patch) | |
| tree | 07dd56d507c200b11eb55a1baf03459d7eb317b1 /Python | |
| parent | 545dcb178e8e56678f5f630799082d7ac0c7c31d (diff) | |
| download | cpython-a702bd4b921167e73f8fc987aa64ada571fdc3f8.zip cpython-a702bd4b921167e73f8fc987aa64ada571fdc3f8.tar.gz cpython-a702bd4b921167e73f8fc987aa64ada571fdc3f8.tar.bz2 | |
bpo-41686: Always create the SIGINT event on Windows (GH-23344) (GH-23347) (GH-23349)
bpo-41686, bpo-41713: On Windows, the SIGINT event,
_PyOS_SigintEvent(), is now created even if Python is configured to
not install signal handlers (PyConfig.install_signal_handlers=0 or
Py_InitializeEx(0)).
(cherry picked from commit 05a5d697f4f097f37c5c1e2ed0e2338a33c3fb6a)
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/pylifecycle.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index dc2d13d..8732d81 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -63,7 +63,6 @@ extern grammar _PyParser_Grammar; /* From graminit.c */ static PyStatus add_main_module(PyInterpreterState *interp); static PyStatus init_import_size(void); static PyStatus init_sys_streams(PyInterpreterState *interp); -static PyStatus init_signals(void); static void call_py_exitfuncs(PyInterpreterState *); static void wait_for_thread_shutdown(void); static void call_ll_exitfuncs(_PyRuntimeState *runtime); @@ -952,11 +951,8 @@ pyinit_main(_PyRuntimeState *runtime, PyInterpreterState *interp) return status; } - if (config->install_signal_handlers) { - status = init_signals(); - if (_PyStatus_EXCEPTION(status)) { - return status; - } + if (_PySignal_Init(config->install_signal_handlers) < 0) { + return _PyStatus_ERR("can't initialize signals"); } if (_PyTraceMalloc_Init(config->tracemalloc) < 0) { @@ -2299,25 +2295,6 @@ Py_Exit(int sts) exit(sts); } -static PyStatus -init_signals(void) -{ -#ifdef SIGPIPE - PyOS_setsig(SIGPIPE, SIG_IGN); -#endif -#ifdef SIGXFZ - PyOS_setsig(SIGXFZ, SIG_IGN); -#endif -#ifdef SIGXFSZ - PyOS_setsig(SIGXFSZ, SIG_IGN); -#endif - PyOS_InitInterrupts(); /* May imply init_signals() */ - if (PyErr_Occurred()) { - return _PyStatus_ERR("can't import signal"); - } - return _PyStatus_OK(); -} - /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. * |
