Skip to content

Commit 8d745f7

Browse files
miss-islingtonBHUVANSH855aisk
authored
[3.14] gh-158643: Document that Py_EnterRecursiveCall uses the C stack, not a counter (GH-158644) (GH-158654)
(cherry picked from commit d6d1ebc) Co-authored-by: Bhuvansh <bhuvanshkataria@gmail.com> Co-authored-by: An Long <aisk@users.noreply.github.com>
1 parent a9eeb9f commit 8d745f7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎Doc/c-api/exceptions.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,10 @@ because the :ref:`call protocol <call>` takes care of recursion handling.
10161016
case, a :exc:`RecursionError` is set and a nonzero value is returned.
10171017
Otherwise, zero is returned.
10181018
1019+
The check is based on the remaining C stack space of the current thread,
1020+
not on a count of calls, so it is unaffected by
1021+
:c:func:`Py_SetRecursionLimit` and :func:`sys.setrecursionlimit`.
1022+
10191023
*where* should be a UTF-8 encoded string such as ``" in instance check"`` to
10201024
be concatenated to the :exc:`RecursionError` message caused by the recursion
10211025
depth limit.
@@ -1026,6 +1030,10 @@ because the :ref:`call protocol <call>` takes care of recursion handling.
10261030
.. versionchanged:: 3.9
10271031
This function is now also available in the :ref:`limited API <limited-c-api>`.
10281032
1033+
.. versionchanged:: 3.14
1034+
The check is based on the remaining C stack space. Previously, a
1035+
separate counter of C-level calls was used.
1036+
10291037
.. c:function:: void Py_LeaveRecursiveCall(void)
10301038
10311039
Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each

0 commit comments

Comments
 (0)