Skip to content

Commit 00032a4

Browse files
miss-islingtonZeroIntensityStanFromIreland
authored
[3.13] gh-141004: Document Py_GetRecursionLimit and Py_SetRecursionLimit (GH-141151) (GH-141157)
* gh-141004: Document `Py_GetRecursionLimit` and `Py_SetRecursionLimit` (GH-141151) (cherry picked from commit 0b26030) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> --------- Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
1 parent f1a9372 commit 00032a4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Doc/c-api/exceptions.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,27 @@ these are the C equivalent to :func:`reprlib.recursive_repr`.
967967
Ends a :c:func:`Py_ReprEnter`. Must be called once for each
968968
invocation of :c:func:`Py_ReprEnter` that returns zero.
969969
970+
.. c:function:: int Py_GetRecursionLimit(void)
971+
972+
Get the recursion limit for the current interpreter. It can be set with
973+
:c:func:`Py_SetRecursionLimit`. The recursion limit prevents the
974+
Python interpreter stack from growing infinitely.
975+
976+
This function cannot fail, and the caller must hold the
977+
:term:`GIL`.
978+
979+
.. seealso::
980+
:py:func:`sys.getrecursionlimit`
981+
982+
.. c:function:: void Py_SetRecursionLimit(int new_limit)
983+
984+
Set the recursion limit for the current interpreter.
985+
986+
This function cannot fail, and the caller must hold the
987+
:term:`GIL`.
988+
989+
.. seealso::
990+
:py:func:`sys.setrecursionlimit`
970991
971992
.. _standardexceptions:
972993

0 commit comments

Comments
 (0)