Skip to content

bpo-37194: Complete PyObject_CallXXX() docs #14156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Object Protocol

Call a callable Python object *callable* without any arguments.

Returns the result of the call on success, or raise an exception and return
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

.. versionadded:: 3.9
Expand All @@ -271,7 +271,8 @@ Object Protocol
*args* must not be *NULL*, use an empty tuple if no arguments are needed.
If no named arguments are needed, *kwargs* can be *NULL*.

Returns the result of the call on success, or *NULL* on failure.
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

This is the equivalent of the Python expression:
``callable(*args, **kwargs)``.
Expand All @@ -282,7 +283,8 @@ Object Protocol
Call a callable Python object *callable*, with arguments given by the
tuple *args*. If no arguments are needed, then *args* can be *NULL*.

Returns the result of the call on success, or *NULL* on failure.
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

This is the equivalent of the Python expression: ``callable(*args)``.

Expand All @@ -293,7 +295,8 @@ Object Protocol
The C arguments are described using a :c:func:`Py_BuildValue` style format
string. The format can be *NULL*, indicating that no arguments are provided.

Returns the result of the call on success, or *NULL* on failure.
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

This is the equivalent of the Python expression: ``callable(*args)``.

Expand All @@ -312,7 +315,8 @@ Object Protocol

The format can be *NULL*, indicating that no arguments are provided.

Returns the result of the call on success, or *NULL* on failure.
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

This is the equivalent of the Python expression:
``obj.name(arg1, arg2, ...)``.
Expand All @@ -330,7 +334,8 @@ Object Protocol
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
of parameters followed by *NULL*.

Returns the result of the call on success, or *NULL* on failure.
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

This is the equivalent of the Python expression:
``callable(arg1, arg2, ...)``.
Expand All @@ -341,7 +346,9 @@ Object Protocol
Calls a method of the Python object *obj*, where the name of the method is given as a
Python string object in *name*. It is called with a variable number of
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
of parameters followed by *NULL*. Returns the result of the call on success, or
of parameters followed by *NULL*.

Return the result of the call on success, or raise an exception and return
*NULL* on failure.


Expand All @@ -365,7 +372,8 @@ Object Protocol
*kwnames* must contain only objects of type ``str`` (not a subclass),
and all keys must be unique.

Return the result of the call on success, or *NULL* on failure.
Return the result of the call on success, or raise an exception and return
*NULL* on failure.

This uses the vectorcall protocol if the callable supports it;
otherwise, the arguments are converted to use
Expand Down