https://github.com/python/cpython/commit/d6d1ebcdc9f758cff7564dd3aa894c004fc55762
commit: d6d1ebcdc9f758cff7564dd3aa894c004fc55762
branch: main
author: Bhuvansh <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-10-03T11:35:03-04:00
summary:

gh-158643: Document that `Py_EnterRecursiveCall` uses the C stack, not a 
counter (GH-158644)

Co-authored-by: An Long <[email protected]>

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

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 40522f8c7b1375..0c8d14dc134ebc 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -1034,6 +1034,10 @@ because the :ref:`call protocol <call>` takes care of 
recursion handling.
    case, a :exc:`RecursionError` is set and a nonzero value is returned.
    Otherwise, zero is returned.
 
+   The check is based on the remaining C stack space of the current thread,
+   not on a count of calls, so it is unaffected by
+   :c:func:`Py_SetRecursionLimit` and :func:`sys.setrecursionlimit`.
+
    *where* should be a UTF-8 encoded string such as ``" in instance check"`` to
    be concatenated to the :exc:`RecursionError` message caused by the recursion
    depth limit.
@@ -1044,6 +1048,10 @@ because the :ref:`call protocol <call>` takes care of 
recursion handling.
    .. versionchanged:: 3.9
       This function is now also available in the :ref:`limited API 
<limited-c-api>`.
 
+   .. versionchanged:: 3.14
+      The check is based on the remaining C stack space.  Previously, a
+      separate counter of C-level calls was used.
+
 .. c:function:: void Py_LeaveRecursiveCall(void)
 
    Ends a :c:func:`Py_EnterRecursiveCall`.  Must be called once for each

_______________________________________________
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