Skip to content

Commit 71031cf

Browse files
authored
bpo-37194: Complete PyObject_CallXXX() docs (GH-14156) (GH-14157)
Mention explicitly that PyObject_CallXXX() functions raise an exception an failure. (cherry picked from commit 1ce2656)
1 parent 988fff5 commit 71031cf

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Doc/c-api/object.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ Object Protocol
261261
*args* must not be *NULL*, use an empty tuple if no arguments are needed.
262262
If no named arguments are needed, *kwargs* can be *NULL*.
263263
264-
Returns the result of the call on success, or *NULL* on failure.
264+
Return the result of the call on success, or raise an exception and return
265+
*NULL* on failure.
265266
266267
This is the equivalent of the Python expression:
267268
``callable(*args, **kwargs)``.
@@ -272,7 +273,8 @@ Object Protocol
272273
Call a callable Python object *callable*, with arguments given by the
273274
tuple *args*. If no arguments are needed, then *args* can be *NULL*.
274275
275-
Returns the result of the call on success, or *NULL* on failure.
276+
Return the result of the call on success, or raise an exception and return
277+
*NULL* on failure.
276278
277279
This is the equivalent of the Python expression: ``callable(*args)``.
278280
@@ -283,7 +285,8 @@ Object Protocol
283285
The C arguments are described using a :c:func:`Py_BuildValue` style format
284286
string. The format can be *NULL*, indicating that no arguments are provided.
285287
286-
Returns the result of the call on success, or *NULL* on failure.
288+
Return the result of the call on success, or raise an exception and return
289+
*NULL* on failure.
287290
288291
This is the equivalent of the Python expression: ``callable(*args)``.
289292
@@ -302,7 +305,8 @@ Object Protocol
302305
303306
The format can be *NULL*, indicating that no arguments are provided.
304307
305-
Returns the result of the call on success, or *NULL* on failure.
308+
Return the result of the call on success, or raise an exception and return
309+
*NULL* on failure.
306310
307311
This is the equivalent of the Python expression:
308312
``obj.name(arg1, arg2, ...)``.
@@ -320,7 +324,8 @@ Object Protocol
320324
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
321325
of parameters followed by *NULL*.
322326
323-
Returns the result of the call on success, or *NULL* on failure.
327+
Return the result of the call on success, or raise an exception and return
328+
*NULL* on failure.
324329
325330
This is the equivalent of the Python expression:
326331
``callable(arg1, arg2, ...)``.
@@ -331,7 +336,9 @@ Object Protocol
331336
Calls a method of the Python object *obj*, where the name of the method is given as a
332337
Python string object in *name*. It is called with a variable number of
333338
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
334-
of parameters followed by *NULL*. Returns the result of the call on success, or
339+
of parameters followed by *NULL*.
340+
341+
Return the result of the call on success, or raise an exception and return
335342
*NULL* on failure.
336343
337344
@@ -355,7 +362,8 @@ Object Protocol
355362
*kwnames* must contain only objects of type ``str`` (not a subclass),
356363
and all keys must be unique.
357364
358-
Return the result of the call on success, or *NULL* on failure.
365+
Return the result of the call on success, or raise an exception and return
366+
*NULL* on failure.
359367
360368
This uses the vectorcall protocol if the callable supports it;
361369
otherwise, the arguments are converted to use

0 commit comments

Comments
 (0)