summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-17 21:55:30 (GMT)
committerGitHub <noreply@github.com>2020-11-17 21:55:30 (GMT)
commit29aa624047f893b3b3194f00252b2156bbbf4f9b (patch)
treec78d32249babc7ffa23a71b2164c8ddc40e0b3ac /Modules
parent282282a1c9347adbd07a2d59c2b861df7580cebb (diff)
downloadcpython-29aa624047f893b3b3194f00252b2156bbbf4f9b.zip
cpython-29aa624047f893b3b3194f00252b2156bbbf4f9b.tar.gz
cpython-29aa624047f893b3b3194f00252b2156bbbf4f9b.tar.bz2
bpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/signalmodule.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 955d4a5..acaaafe 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -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
_PySignal_Init(int install_signal_handlers)
{