summaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-24 02:22:38 -0700
committerGitHub <noreply@github.com>2019-05-24 02:22:38 -0700
commit310f414bbd4d6ed1d8813f724c91ce9b4129c0ba (patch)
treebca2f14b6b451d2300e1a5b5e87785eb83f8cbcc /Doc
parenta3488e5902f5c26e5cc289aec2518e7b5058e5d1 (diff)
downloadcpython-git-310f414bbd4d6ed1d8813f724c91ce9b4129c0ba.tar.gz
bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not handled (GH-7778)
``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python. (cherry picked from commit 608876b6b1eb59538e6c29671a733033fb8b5be7) Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/exceptions.rst12
-rw-r--r--Doc/library/_thread.rst8
2 files changed, 12 insertions, 8 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 79e6f97a44..13e00b5448 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -516,13 +516,13 @@ Signal Handling
single: SIGINT
single: KeyboardInterrupt (built-in exception)
- This function simulates the effect of a :const:`SIGINT` signal arriving --- the
- next time :c:func:`PyErr_CheckSignals` is called, :exc:`KeyboardInterrupt` will
- be raised. It may be called without holding the interpreter lock.
-
- .. % XXX This was described as obsolete, but is used in
- .. % _thread.interrupt_main() (used from IDLE), so it's still needed.
+ Simulate the effect of a :const:`SIGINT` signal arriving. The next time
+ :c:func:`PyErr_CheckSignals` is called, the Python signal handler for
+ :const:`SIGINT` will be called.
+ If :const:`SIGINT` isn't handled by Python (it was set to
+ :data:`signal.SIG_DFL` or :data:`signal.SIG_IGN`), this function does
+ nothing.
.. c:function:: int PySignal_SetWakeupFd(int fd)
diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst
index acffabf24b..d1c28f479e 100644
--- a/Doc/library/_thread.rst
+++ b/Doc/library/_thread.rst
@@ -53,8 +53,12 @@ This module defines the following constants and functions:
.. function:: interrupt_main()
- Raise a :exc:`KeyboardInterrupt` exception in the main thread. A subthread can
- use this function to interrupt the main thread.
+ Simulate the effect of a :data:`signal.SIGINT` signal arriving in the main
+ thread. A thread can use this function to interrupt the main thread.
+
+ If :data:`signal.SIGINT` isn't handled by Python (it was set to
+ :data:`signal.SIG_DFL` or :data:`signal.SIG_IGN`), this function does
+ nothing.
.. function:: exit()