Skip to content

[3.8] Document most common signals (GH-19245) #19257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions Doc/library/signal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -297,6 +401,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.

Expand Down
2 changes: 1 addition & 1 deletion Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@ init_signals(void)
#ifdef SIGXFSZ
PyOS_setsig(SIGXFSZ, SIG_IGN);
#endif
PyOS_InitInterrupts(); /* May imply initsignal() */
PyOS_InitInterrupts(); /* May imply init_signals() */
if (PyErr_Occurred()) {
return _PyStatus_ERR("can't import signal");
}
Expand Down