Skip to content

Commit a71ed5c

Browse files
ZeroIntensityStanFromIreland
authored andcommitted
gh-141004: Document Py_GetRecursionLimit and Py_SetRecursionLimit (GH-141151)
(cherry picked from commit 0b26030) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent f1a9372 commit a71ed5c

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 an
977+
:term:`attached thread state`.
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 an
987+
:term:`attached thread state`.
988+
989+
.. seealso::
990+
:py:func:`sys.setrecursionlimit`
970991
971992
.. _standardexceptions:
972993

0 commit comments

Comments
 (0)