Skip to content

Commit 1ce2656

Browse files
authored
bpo-37194: Complete PyObject_CallXXX() docs (GH-14156)
Mention explicitly that PyObject_CallXXX() functions raise an exception an failure.
1 parent 2ff58a2 commit 1ce2656

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Doc/c-api/object.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Object Protocol
257257
258258
Call a callable Python object *callable* without any arguments.
259259
260-
Returns the result of the call on success, or raise an exception and return
260+
Return the result of the call on success, or raise an exception and return
261261
*NULL* on failure.
262262
263263
.. versionadded:: 3.9
@@ -271,7 +271,8 @@ Object Protocol
271271
*args* must not be *NULL*, use an empty tuple if no arguments are needed.
272272
If no named arguments are needed, *kwargs* can be *NULL*.
273273
274-
Returns the result of the call on success, or *NULL* on failure.
274+
Return the result of the call on success, or raise an exception and return
275+
*NULL* on failure.
275276
276277
This is the equivalent of the Python expression:
277278
``callable(*args, **kwargs)``.
@@ -282,7 +283,8 @@ Object Protocol
282283
Call a callable Python object *callable*, with arguments given by the
283284
tuple *args*. If no arguments are needed, then *args* can be *NULL*.
284285
285-
Returns the result of the call on success, or *NULL* on failure.
286+
Return the result of the call on success, or raise an exception and return
287+
*NULL* on failure.
286288
287289
This is the equivalent of the Python expression: ``callable(*args)``.
288290
@@ -293,7 +295,8 @@ Object Protocol
293295
The C arguments are described using a :c:func:`Py_BuildValue` style format
294296
string. The format can be *NULL*, indicating that no arguments are provided.
295297
296-
Returns the result of the call on success, or *NULL* on failure.
298+
Return the result of the call on success, or raise an exception and return
299+
*NULL* on failure.
297300
298301
This is the equivalent of the Python expression: ``callable(*args)``.
299302
@@ -312,7 +315,8 @@ Object Protocol
312315
313316
The format can be *NULL*, indicating that no arguments are provided.
314317
315-
Returns the result of the call on success, or *NULL* on failure.
318+
Return the result of the call on success, or raise an exception and return
319+
*NULL* on failure.
316320
317321
This is the equivalent of the Python expression:
318322
``obj.name(arg1, arg2, ...)``.
@@ -330,7 +334,8 @@ Object Protocol
330334
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
331335
of parameters followed by *NULL*.
332336
333-
Returns the result of the call on success, or *NULL* on failure.
337+
Return the result of the call on success, or raise an exception and return
338+
*NULL* on failure.
334339
335340
This is the equivalent of the Python expression:
336341
``callable(arg1, arg2, ...)``.
@@ -341,7 +346,9 @@ Object Protocol
341346
Calls a method of the Python object *obj*, where the name of the method is given as a
342347
Python string object in *name*. It is called with a variable number of
343348
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
344-
of parameters followed by *NULL*. Returns the result of the call on success, or
349+
of parameters followed by *NULL*.
350+
351+
Return the result of the call on success, or raise an exception and return
345352
*NULL* on failure.
346353
347354
@@ -365,7 +372,8 @@ Object Protocol
365372
*kwnames* must contain only objects of type ``str`` (not a subclass),
366373
and all keys must be unique.
367374
368-
Return the result of the call on success, or *NULL* on failure.
375+
Return the result of the call on success, or raise an exception and return
376+
*NULL* on failure.
369377
370378
This uses the vectorcall protocol if the callable supports it;
371379
otherwise, the arguments are converted to use

0 commit comments

Comments
 (0)