diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-06-17 13:23:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 13:23:59 (GMT) |
commit | 71031cf4ed5ac9e330c8890b92379d9df383925b (patch) | |
tree | 8f40186941d7b41edb50f616c5025b351467300c /Doc/c-api | |
parent | 988fff5d0e7fccecbf776c08ec56695820b3b4a8 (diff) | |
download | cpython-71031cf4ed5ac9e330c8890b92379d9df383925b.zip cpython-71031cf4ed5ac9e330c8890b92379d9df383925b.tar.gz cpython-71031cf4ed5ac9e330c8890b92379d9df383925b.tar.bz2 |
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 1ce2656f13e726b3b99d4c968926908cff1f460a)
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/object.rst | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index ce0d059..187a025 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -261,7 +261,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)``. @@ -272,7 +273,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)``. @@ -283,7 +285,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)``. @@ -302,7 +305,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, ...)``. @@ -320,7 +324,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, ...)``. @@ -331,7 +336,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. @@ -355,7 +362,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 |