https://github.com/python/cpython/commit/72a8ea773baaf5049d06fdc3b314bfe661846b58
commit: 72a8ea773baaf5049d06fdc3b314bfe661846b58
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2025-11-14T11:26:37Z
summary:

[3.14] gh-141004: Document `PyOS_InterruptOccurred` (GH-141526) (GH-141549)

gh-141004: Document `PyOS_InterruptOccurred` (GH-141526)
(cherry picked from commit ef90261be508b97d682589aac8f00065a9585683)

Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Doc/c-api/sys.rst

diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
index b3c89800e386ff..3a8cfd95b03513 100644
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -123,6 +123,24 @@ Operating System Utilities
    This is a thin wrapper around either :c:func:`!sigaction` or 
:c:func:`!signal`.  Do
    not call those functions directly!
 
+
+.. c:function:: int PyOS_InterruptOccurred(void)
+
+   Check if a :c:macro:`!SIGINT` signal has been received.
+
+   Returns ``1`` if a :c:macro:`!SIGINT` has occurred and clears the signal 
flag,
+   or ``0`` otherwise.
+
+   In most cases, you should prefer :c:func:`PyErr_CheckSignals` over this 
function.
+   :c:func:`!PyErr_CheckSignals` invokes the appropriate signal handlers
+   for all pending signals, allowing Python code to handle the signal properly.
+   This function only detects :c:macro:`!SIGINT` and does not invoke any Python
+   signal handlers.
+
+   This function is async-signal-safe and this function cannot fail.
+   The caller must hold an :term:`attached thread state`.
+
+
 .. c:function:: wchar_t* Py_DecodeLocale(const char* arg, size_t *size)
 
    .. warning::

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to