From acc719e607ddbf171f18d4249f4ca80214dd8633 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Thu, 6 Nov 2025 08:37:46 -0500 Subject: [PATCH 1/2] Document Py_MakePendingCalls() --- Doc/c-api/init.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 49ffeab55850c0..3af4b22b62b38d 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1854,6 +1854,19 @@ pointer and a void pointer argument. This function now always schedules *func* to be run in the main interpreter. + +.. c:function:: int Py_MakePendingCalls(void) + + Execute all pending calls. This is usually executed automatically by the + interpreter. If this is not called in the main thread of the main + interpreter, this function does nothing and returns ``0``. + + This function returns ``0`` on success, and returns ``-1`` with an exception + set on failure. + + The caller must hold an :term:`attached thread state`. + + .. _profiling: Profiling and Tracing From 792a5ce19814c9337cc5f6c3b4c0cde9e7c9d12b Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Thu, 6 Nov 2025 08:40:38 -0500 Subject: [PATCH 2/2] Add versionadded and versionchanged notes. --- Doc/c-api/init.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 3af4b22b62b38d..802aa8e3837e5e 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1866,6 +1866,11 @@ pointer and a void pointer argument. The caller must hold an :term:`attached thread state`. + .. versionadded:: 3.1 + + .. versionchanged:: 3.12 + This function only runs pending calls in the main interpreter. + .. _profiling: