https://github.com/python/cpython/commit/00032a424515eee88611645583e57ad60c5b2666
commit: 00032a424515eee88611645583e57ad60c5b2666
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2025-11-06T17:00:03Z
summary:

[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 0b260305d302eace7d59931ca582a1953d894018)

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]>

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

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 10cb33990c55ca..cea03b24b4d61a 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -967,6 +967,27 @@ these are the C equivalent to 
:func:`reprlib.recursive_repr`.
    Ends a :c:func:`Py_ReprEnter`.  Must be called once for each
    invocation of :c:func:`Py_ReprEnter` that returns zero.
 
+.. c:function:: int Py_GetRecursionLimit(void)
+
+   Get the recursion limit for the current interpreter. It can be set with
+   :c:func:`Py_SetRecursionLimit`. The recursion limit prevents the
+   Python interpreter stack from growing infinitely.
+
+   This function cannot fail, and the caller must hold the
+   :term:`GIL`.
+
+   .. seealso::
+      :py:func:`sys.getrecursionlimit`
+
+.. c:function:: void Py_SetRecursionLimit(int new_limit)
+
+   Set the recursion limit for the current interpreter.
+
+   This function cannot fail, and the caller must hold the
+   :term:`GIL`.
+
+   .. seealso::
+      :py:func:`sys.setrecursionlimit`
 
 .. _standardexceptions:
 

_______________________________________________
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