diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-17 16:22:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 16:22:23 +0100 |
commit | 296a796951032f678d063008f588ccc6958d0df1 (patch) | |
tree | 91fa9ac02ef9786aeb741d13d07a0cd027d34d02 /Python/pylifecycle.c | |
parent | bpo-40637: Don't test builtin PBKDF2 without builtin hashes (GH-20980) (diff) | |
download | cpython-296a796951032f678d063008f588ccc6958d0df1.tar.gz cpython-296a796951032f678d063008f588ccc6958d0df1.tar.bz2 cpython-296a796951032f678d063008f588ccc6958d0df1.zip |
bpo-41713: Remove PyOS_InitInterrupts() function (GH-23342)
Remove the undocumented PyOS_InitInterrupts() C function.
* Rename PyOS_InitInterrupts() to _PySignal_Init(). It now installs
other signal handlers, not only SIGINT.
* Rename PyOS_FiniInterrupts() to _PySignal_Fini()
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 33deafbc0a2..77a18e17e07 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -54,7 +54,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); @@ -1047,11 +1046,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) { @@ -1702,7 +1698,7 @@ Py_FinalizeEx(void) } /* Disable signal handling */ - PyOS_FiniInterrupts(); + _PySignal_Fini(); /* Collect garbage. This may call finalizers; it's nice to call these * before all modules are destroyed. @@ -2730,25 +2726,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. * |