diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-04 18:48:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-04 18:48:34 (GMT) |
commit | f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613 (patch) | |
tree | b42e4aaf30370f71b5622f8a41976ac71706d8e8 /Doc/c-api | |
parent | 6552563b3d5061816720a5a6c7d4ffd6ba35b98b (diff) | |
download | cpython-f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613.zip cpython-f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613.tar.gz cpython-f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613.tar.bz2 |
bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)
Provide Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as
regular functions for the limited API. Previously, there were defined
as macros, but these macros didn't work with the limited API which
cannot access PyThreadState.recursion_depth field.
Remove _Py_CheckRecursionLimit from the stable ABI.
Add Include/cpython/ceval.h header file.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/exceptions.rst | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index c7ba74c..a042c6e 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -715,15 +715,21 @@ recursion depth automatically). case, a :exc:`RecursionError` is set and a nonzero value is returned. Otherwise, zero is returned. - *where* should be a string such as ``" in instance check"`` to be - concatenated to the :exc:`RecursionError` message caused by the recursion + *where* should be a UTF-8 encoded string such as ``" in instance check"`` to + be concatenated to the :exc:`RecursionError` message caused by the recursion depth limit. -.. c:function:: void Py_LeaveRecursiveCall() + .. versionchanged:: 3.9 + This function is now also available in the limited API. + +.. c:function:: void Py_LeaveRecursiveCall(void) Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each *successful* invocation of :c:func:`Py_EnterRecursiveCall`. + .. versionchanged:: 3.9 + This function is now also available in the limited API. + Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types requires special recursion handling. In addition to protecting the stack, :c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent cycles. The |