Skip to content

Commit 40e1b04

Browse files
authored
Document most common signals (GH-19245) (GH-19257)
Document individual signals (only the most common signals): description, default action, availability. (cherry picked from commit 400e1db)
1 parent 4ced9a7 commit 40e1b04

File tree

2 files changed

+107
-1
lines changed

2 files changed

+107
-1
lines changed

Doc/library/signal.rst

+106
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,110 @@ The variables defined in the :mod:`signal` module are:
9191
signal.
9292

9393

94+
.. data:: SIGABRT
95+
96+
Abort signal from :manpage:`abort(3)`.
97+
98+
.. data:: SIGALRM
99+
100+
Timer signal from :manpage:`alarm(2)`.
101+
102+
.. availability:: Unix.
103+
104+
.. data:: SIGBREAK
105+
106+
Interrupt from keyboard (CTRL + BREAK).
107+
108+
.. availability:: Windows.
109+
110+
.. data:: SIGBUS
111+
112+
Bus error (bad memory access).
113+
114+
.. availability:: Unix.
115+
116+
.. data:: SIGCHLD
117+
118+
Child process stopped or terminated.
119+
120+
.. availability:: Windows.
121+
122+
.. data:: SIGCLD
123+
124+
Alias to :data:`SIGCHLD`.
125+
126+
.. data:: SIGCONT
127+
128+
Continue the process if it is currently stopped
129+
130+
.. availability:: Unix.
131+
132+
.. data:: SIGFPE
133+
134+
Floating-point exception. For example, division by zero.
135+
136+
.. seealso::
137+
:exc:`ZeroDivisionError` is raised when the second argument of a division
138+
or modulo operation is zero.
139+
140+
.. data:: SIGHUP
141+
142+
Hangup detected on controlling terminal or death of controlling process.
143+
144+
.. availability:: Unix.
145+
146+
.. data:: SIGILL
147+
148+
Illegal instruction.
149+
150+
.. data:: SIGINT
151+
152+
Interrupt from keyboard (CTRL + C).
153+
154+
Default action is to raise :exc:`KeyboardInterrupt`.
155+
156+
.. data:: SIGKILL
157+
158+
Kill signal.
159+
160+
It cannot be caught, blocked, or ignored.
161+
162+
.. availability:: Unix.
163+
164+
.. data:: SIGPIPE
165+
166+
Broken pipe: write to pipe with no readers.
167+
168+
Default action is to ignore the signal.
169+
170+
.. availability:: Unix.
171+
172+
.. data:: SIGSEGV
173+
174+
Segmentation fault: invalid memory reference.
175+
176+
.. data:: SIGTERM
177+
178+
Termination signal.
179+
180+
.. data:: SIGUSR1
181+
182+
User-defined signal 1.
183+
184+
.. availability:: Unix.
185+
186+
.. data:: SIGUSR2
187+
188+
User-defined signal 2.
189+
190+
.. availability:: Unix.
191+
192+
.. data:: SIGWINCH
193+
194+
Window resize signal.
195+
196+
.. availability:: Unix.
197+
94198
.. data:: SIG*
95199

96200
All the signal numbers are defined symbolically. For example, the hangup signal
@@ -297,6 +401,8 @@ The :mod:`signal` module defines the following functions:
297401
For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the
298402
signal mask of the calling thread.
299403

404+
:data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked.
405+
300406
.. availability:: Unix. See the man page :manpage:`sigprocmask(3)` and
301407
:manpage:`pthread_sigmask(3)` for further information.
302408

Python/pylifecycle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@ init_signals(void)
23112311
#ifdef SIGXFSZ
23122312
PyOS_setsig(SIGXFSZ, SIG_IGN);
23132313
#endif
2314-
PyOS_InitInterrupts(); /* May imply initsignal() */
2314+
PyOS_InitInterrupts(); /* May imply init_signals() */
23152315
if (PyErr_Occurred()) {
23162316
return _PyStatus_ERR("can't import signal");
23172317
}

0 commit comments

Comments
 (0)