From acc719e607ddbf171f18d4249f4ca80214dd8633 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Thu, 6 Nov 2025 08:37:46 -0500 Subject: [PATCH 1/4] 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/4] 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: From 09917c0618a17af29f083381166570f7dba1452a Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Thu, 20 Nov 2025 08:12:32 -0500 Subject: [PATCH 3/4] Update Doc/c-api/init.rst Co-authored-by: Victor Stinner --- Doc/c-api/init.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 802aa8e3837e5e..00e42214623ffe 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1858,12 +1858,13 @@ pointer and a void pointer argument. .. 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``. + interpreter. This function returns ``0`` on success, and returns ``-1`` with an exception set on failure. - + + If this is not called in the main thread of the main + interpreter, this function does nothing and returns ``0``. The caller must hold an :term:`attached thread state`. .. versionadded:: 3.1 From 740c08f06d6c97d5e1da22a977cce95a3df30af5 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Thu, 20 Nov 2025 08:32:04 -0500 Subject: [PATCH 4/4] Remove whitespace --- Doc/c-api/init.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 00e42214623ffe..fcd88b7b052f5a 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1862,7 +1862,7 @@ pointer and a void pointer argument. This function returns ``0`` on success, and returns ``-1`` with an exception set on failure. - + If this is not called in the main thread of the main interpreter, this function does nothing and returns ``0``. The caller must hold an :term:`attached thread state`.