Skip to content

Commit 29aa624

Browse files
authored
bpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)
1 parent 282282a commit 29aa624

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

‎Modules/signalmodule.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,29 @@ signal_install_handlers(void)
17701770
}
17711771

17721772

1773+
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
1774+
*
1775+
* All of the code in this function must only use async-signal-safe functions,
1776+
* listed at `man 7 signal` or
1777+
* http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
1778+
*
1779+
* If this function is updated, update also _posix_spawn() of subprocess.py.
1780+
*/
1781+
void
1782+
_Py_RestoreSignals(void)
1783+
{
1784+
#ifdef SIGPIPE
1785+
PyOS_setsig(SIGPIPE, SIG_DFL);
1786+
#endif
1787+
#ifdef SIGXFZ
1788+
PyOS_setsig(SIGXFZ, SIG_DFL);
1789+
#endif
1790+
#ifdef SIGXFSZ
1791+
PyOS_setsig(SIGXFSZ, SIG_DFL);
1792+
#endif
1793+
}
1794+
1795+
17731796
int
17741797
_PySignal_Init(int install_signal_handlers)
17751798
{

‎Python/pylifecycle.c‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,29 +2727,6 @@ Py_Exit(int sts)
27272727
}
27282728

27292729

2730-
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
2731-
*
2732-
* All of the code in this function must only use async-signal-safe functions,
2733-
* listed at `man 7 signal` or
2734-
* http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
2735-
*
2736-
* If this function is updated, update also _posix_spawn() of subprocess.py.
2737-
*/
2738-
void
2739-
_Py_RestoreSignals(void)
2740-
{
2741-
#ifdef SIGPIPE
2742-
PyOS_setsig(SIGPIPE, SIG_DFL);
2743-
#endif
2744-
#ifdef SIGXFZ
2745-
PyOS_setsig(SIGXFZ, SIG_DFL);
2746-
#endif
2747-
#ifdef SIGXFSZ
2748-
PyOS_setsig(SIGXFSZ, SIG_DFL);
2749-
#endif
2750-
}
2751-
2752-
27532730
/*
27542731
* The file descriptor fd is considered ``interactive'' if either
27552732
* a) isatty(fd) is TRUE, or

0 commit comments

Comments
 (0)