Skip to content

Commit 3f295d7

Browse files
committed
Convert note to a more friendly example
1 parent 80a26ef commit 3f295d7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Doc/c-api/exceptions.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -673,13 +673,17 @@ Signal Handling
673673
single: SIGINT (C macro)
674674
single: KeyboardInterrupt (built-in exception)
675675
676+
Handle external interruptions, such as signals or activating a debugger,
677+
whose processing has been delayed until it is safe
678+
to run Python code and/or raise exceptions.
676679
680+
For example, pressing :kbd:`Ctrl-C` causes a terminal to send the
681+
:py:data:`signal.SIGINT` signal.
682+
This function executes the corresponding Python signal handler, which,
683+
by default, raises the :exc:`KeyboardInterrupt` exception.
677684
678-
Handle external interruptions, such as signals (including :kbd:`Ctrl-C`),
679-
or activating a debugger, whose processing has been delayed until it is safe
680-
to run Python code and/or raise exceptions.
681-
The function should be called by long-running C code frequently
682-
enough so that the response appears immediate to humans.
685+
:c:func:`!PyErr_CheckSignals` should be called by long-running C code
686+
frequently enough so that the response appears immediate to humans.
683687
684688
Handlers invoked by this function currently include:
685689
@@ -703,10 +707,6 @@ Signal Handling
703707
If all handlers finish successfully, or there are no handlers to run,
704708
return ``0``.
705709
706-
.. note::
707-
The default Python signal handler for :py:data:`signal.SIGINT` raises the
708-
:exc:`KeyboardInterrupt` exception.
709-
710710
.. versionchanged:: 3.12
711711
This function may now invoke the garbage collector.
712712

0 commit comments

Comments
 (0)