Skip to content

Commit 400e1db

Browse files
authored
Document most common signals (GH-19245)
Document individual signals (only the most common signals): description, default action, availability.
1 parent cd16661 commit 400e1db

File tree

2 files changed

+107
-1
lines changed

2 files changed

+107
-1
lines changed

Doc/library/signal.rst

Lines changed: 106 additions & 0 deletions
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
@@ -310,6 +414,8 @@ The :mod:`signal` module defines the following functions:
310414
For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the
311415
signal mask of the calling thread.
312416

417+
:data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked.
418+
313419
.. availability:: Unix. See the man page :manpage:`sigprocmask(3)` and
314420
:manpage:`pthread_sigmask(3)` for further information.
315421

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2433,7 +2433,7 @@ init_signals(PyThreadState *tstate)
24332433
#ifdef SIGXFSZ
24342434
PyOS_setsig(SIGXFSZ, SIG_IGN);
24352435
#endif
2436-
PyOS_InitInterrupts(); /* May imply initsignal() */
2436+
PyOS_InitInterrupts(); /* May imply init_signals() */
24372437
if (_PyErr_Occurred(tstate)) {
24382438
return _PyStatus_ERR("can't import signal");
24392439
}

0 commit comments

Comments
 (0)