bpo-36974: expand call protocol documentation · python/cpython@784fb45 · GitHub
Skip to content

Commit 784fb45

Browse files
committed
bpo-36974: expand call protocol documentation
1 parent fde9cf7 commit 784fb45

6 files changed

Lines changed: 206 additions & 99 deletions

File tree

Doc/c-api/call.rst

Lines changed: 144 additions & 46 deletions

Doc/c-api/exceptions.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,17 @@ The following functions are used to create and modify Unicode exceptions from C.
695695
``0`` on success, ``-1`` on failure.
696696
697697
698+
.. _recursion:
699+
698700
Recursion Control
699701
=================
700702
701703
These two functions provide a way to perform safe recursive calls at the C
702704
level, both in the core and in extension modules. They are needed if the
703705
recursive code does not necessarily invoke Python code (which tracks its
704706
recursion depth automatically).
707+
It's also not needed for *tp_call* implementations
708+
because the :ref:`call protocol <call>` takes care of recursion handling.
705709
706710
.. c:function:: int Py_EnterRecursiveCall(const char *where)
707711

Doc/c-api/structures.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ also keyword arguments. So there are a total of 6 calling conventions:
201201

202202
Extension of :const:`METH_FASTCALL` supporting also keyword arguments,
203203
with methods of type :c:type:`_PyCFunctionFastWithKeywords`.
204-
Keyword arguments are passed the same way as in the vectorcall protocol:
204+
Keyword arguments are passed the same way as in the
205+
:ref:`vectorcall protocol <vectorcall>`:
205206
there is an additional fourth :c:type:`PyObject\*` parameter
206207
which is a tuple representing the names of the keyword arguments
207208
(which are guaranteed to be strings)

Doc/c-api/type.rst

Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)