[Python-checkins] bpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)
vstinner
webhook-mailer at python.org
Tue Nov 17 16:55:40 EST 2020
https://github.com/python/cpython/commit/29aa624047f893b3b3194f00252b2156bbbf4f9b
commit: 29aa624047f893b3b3194f00252b2156bbbf4f9b
branch: master
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2020年11月17日T22:55:30+01:00
summary:
bpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)
files:
M Modules/signalmodule.c
M Python/pylifecycle.c
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 955d4a56e5462..acaaafe89d124 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)
{
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 77a18e17e07ea..82ce4f15ad283 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -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
* a) isatty(fd) is TRUE, or
More information about the Python-checkins
mailing list