bpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)

This commit is contained in:
Victor Stinner 2020-11-17 22:55:30 +01:00 committed by GitHub
parent 282282a1c9
commit 29aa624047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 23 deletions

View File

@ -1770,6 +1770,29 @@ signal_install_handlers(void)
} }
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
*
* All of the code in this function must only use async-signal-safe functions,
* listed at `man 7 signal` or
* http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
*
* If this function is updated, update also _posix_spawn() of subprocess.py.
*/
void
_Py_RestoreSignals(void)
{
#ifdef SIGPIPE
PyOS_setsig(SIGPIPE, SIG_DFL);
#endif
#ifdef SIGXFZ
PyOS_setsig(SIGXFZ, SIG_DFL);
#endif
#ifdef SIGXFSZ
PyOS_setsig(SIGXFSZ, SIG_DFL);
#endif
}
int int
_PySignal_Init(int install_signal_handlers) _PySignal_Init(int install_signal_handlers)
{ {

View File

@ -2727,29 +2727,6 @@ Py_Exit(int sts)
} }
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
*
* All of the code in this function must only use async-signal-safe functions,
* listed at `man 7 signal` or
* http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
*
* If this function is updated, update also _posix_spawn() of subprocess.py.
*/
void
_Py_RestoreSignals(void)
{
#ifdef SIGPIPE
PyOS_setsig(SIGPIPE, SIG_DFL);
#endif
#ifdef SIGXFZ
PyOS_setsig(SIGXFZ, SIG_DFL);
#endif
#ifdef SIGXFSZ
PyOS_setsig(SIGXFSZ, SIG_DFL);
#endif
}
/* /*
* The file descriptor fd is considered ``interactive'' if either * The file descriptor fd is considered ``interactive'' if either
* a) isatty(fd) is TRUE, or * a) isatty(fd) is TRUE, or