summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-31 17:13:10 (GMT)
committerGitHub <noreply@github.com>2020-03-31 17:13:10 (GMT)
commit400e1dbcad93061f1f7ab4735202daaa5e731507 (patch)
treed82ab77d754ce10d7685cf1fde1b9c9a4aed917e
parentcd16661f903153ecac55f190ed682e576c5deb24 (diff)
downloadcpython-400e1dbcad93061f1f7ab4735202daaa5e731507.zip
cpython-400e1dbcad93061f1f7ab4735202daaa5e731507.tar.gz
cpython-400e1dbcad93061f1f7ab4735202daaa5e731507.tar.bz2
Document most common signals (GH-19245)
Document individual signals (only the most common signals): description, default action, availability.
-rw-r--r--Doc/library/signal.rst106
-rw-r--r--Python/pylifecycle.c2
2 files changed, 107 insertions, 1 deletions
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index 4353cc7..05b285e 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -91,6 +91,110 @@ The variables defined in the :mod:`signal` module are:
signal.
+.. data:: SIGABRT
+
+ Abort signal from :manpage:`abort(3)`.
+
+.. data:: SIGALRM
+
+ Timer signal from :manpage:`alarm(2)`.
+
+ .. availability:: Unix.
+
+.. data:: SIGBREAK
+
+ Interrupt from keyboard (CTRL + BREAK).
+
+ .. availability:: Windows.
+
+.. data:: SIGBUS
+
+ Bus error (bad memory access).
+
+ .. availability:: Unix.
+
+.. data:: SIGCHLD
+
+ Child process stopped or terminated.
+
+ .. availability:: Windows.
+
+.. data:: SIGCLD
+
+ Alias to :data:`SIGCHLD`.
+
+.. data:: SIGCONT
+
+ Continue the process if it is currently stopped
+
+ .. availability:: Unix.
+
+.. data:: SIGFPE
+
+ Floating-point exception. For example, division by zero.
+
+ .. seealso::
+ :exc:`ZeroDivisionError` is raised when the second argument of a division
+ or modulo operation is zero.
+
+.. data:: SIGHUP
+
+ Hangup detected on controlling terminal or death of controlling process.
+
+ .. availability:: Unix.
+
+.. data:: SIGILL
+
+ Illegal instruction.
+
+.. data:: SIGINT
+
+ Interrupt from keyboard (CTRL + C).
+
+ Default action is to raise :exc:`KeyboardInterrupt`.
+
+.. data:: SIGKILL
+
+ Kill signal.
+
+ It cannot be caught, blocked, or ignored.
+
+ .. availability:: Unix.
+
+.. data:: SIGPIPE
+
+ Broken pipe: write to pipe with no readers.
+
+ Default action is to ignore the signal.
+
+ .. availability:: Unix.
+
+.. data:: SIGSEGV
+
+ Segmentation fault: invalid memory reference.
+
+.. data:: SIGTERM
+
+ Termination signal.
+
+.. data:: SIGUSR1
+
+ User-defined signal 1.
+
+ .. availability:: Unix.
+
+.. data:: SIGUSR2
+
+ User-defined signal 2.
+
+ .. availability:: Unix.
+
+.. data:: SIGWINCH
+
+ Window resize signal.
+
+ .. availability:: Unix.
+
.. data:: SIG*
All the signal numbers are defined symbolically. For example, the hangup signal
@@ -310,6 +414,8 @@ The :mod:`signal` module defines the following functions:
For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the
signal mask of the calling thread.
+ :data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked.
+
.. availability:: Unix. See the man page :manpage:`sigprocmask(3)` and
:manpage:`pthread_sigmask(3)` for further information.
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 4c27738..2d5cb0f 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2433,7 +2433,7 @@ init_signals(PyThreadState *tstate)
#ifdef SIGXFSZ
PyOS_setsig(SIGXFSZ, SIG_IGN);
#endif
- PyOS_InitInterrupts(); /* May imply initsignal() */
+ PyOS_InitInterrupts(); /* May imply init_signals() */
if (_PyErr_Occurred(tstate)) {
return _PyStatus_ERR("can't import signal");
}