summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-17 17:58:12 (GMT)
committerGitHub <noreply@github.com>2020-11-17 17:58:12 (GMT)
commit05a5d697f4f097f37c5c1e2ed0e2338a33c3fb6a (patch)
tree21cc60d0f86bdb294f9872d800127fb08436d637 /Python
parentac472b316cbb22ab8b750a474e991b46d1e92e15 (diff)
downloadcpython-05a5d697f4f097f37c5c1e2ed0e2338a33c3fb6a.zip
cpython-05a5d697f4f097f37c5c1e2ed0e2338a33c3fb6a.tar.gz
cpython-05a5d697f4f097f37c5c1e2ed0e2338a33c3fb6a.tar.bz2
bpo-41686: Always create the SIGINT event on Windows (GH-23344) (GH-23347)
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)).
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index cfb3a7d..5c50d4d 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -57,7 +57,6 @@ static PyStatus add_main_module(PyInterpreterState *interp);
static PyStatus init_import_site(void);
static PyStatus init_set_builtins_open(void);
static PyStatus init_sys_streams(PyThreadState *tstate);
-static PyStatus init_signals(PyThreadState *tstate);
static void call_py_exitfuncs(PyThreadState *tstate);
static void wait_for_thread_shutdown(PyThreadState *tstate);
static void call_ll_exitfuncs(_PyRuntimeState *runtime);
@@ -1013,11 +1012,8 @@ init_interp_main(PyThreadState *tstate)
}
if (is_main_interp) {
- if (config->install_signal_handlers) {
- status = init_signals(tstate);
- 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) {
@@ -2442,25 +2438,6 @@ Py_Exit(int sts)
exit(sts);
}
-static PyStatus
-init_signals(PyThreadState *tstate)
-{
-#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(tstate)) {
- return _PyStatus_ERR("can't import signal");
- }
- return _PyStatus_OK();
-}
-
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
*