Skip to content

Commit 0b26030

Browse files
gh-141004: Document Py_GetRecursionLimit and Py_SetRecursionLimit (GH-141151)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent bea0d3d commit 0b26030

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
@@ -979,6 +979,27 @@ these are the C equivalent to :func:`reprlib.recursive_repr`.
979979
Ends a :c:func:`Py_ReprEnter`. Must be called once for each
980980
invocation of :c:func:`Py_ReprEnter` that returns zero.
981981
982+
.. c:function:: int Py_GetRecursionLimit(void)
983+
984+
Get the recursion limit for the current interpreter. It can be set with
985+
:c:func:`Py_SetRecursionLimit`. The recursion limit prevents the
986+
Python interpreter stack from growing infinitely.
987+
988+
This function cannot fail, and the caller must hold an
989+
:term:`attached thread state`.
990+
991+
.. seealso::
992+
:py:func:`sys.getrecursionlimit`
993+
994+
.. c:function:: void Py_SetRecursionLimit(int new_limit)
995+
996+
Set the recursion limit for the current interpreter.
997+
998+
This function cannot fail, and the caller must hold an
999+
:term:`attached thread state`.
1000+
1001+
.. seealso::
1002+
:py:func:`sys.setrecursionlimit`
9821003
9831004
.. _standardexceptions:
9841005

0 commit comments

Comments
 (0)