HPy Call API¶
-
HPy
HPy_Call(HPyContext *ctx, HPy callable, const HPy *args, size_t nargs, HPy kwnames)¶
[source] Call a Python object.
- Parameters
ctx – The execution context.
callable – A handle to the Python object to call (must not be
HPy_NULL).args – A pointer to an array of positional and keyword arguments. This argument must not be
NULLifnargs > 0orHPy_Length(ctx, kwnames) > 0.nargs – The number of positional arguments in
args.kwnames – A handle to the tuple of keyword argument names (may be
HPy_NULL). The values of the keyword arguments are also passed inargsappended to the positional arguments. Argumentnargsdoes not include the keyword argument count.
- Returns
The result of the call on success, or
HPy_NULLin case of an error.
-
HPy
HPy_CallMethod(HPyContext *ctx, HPy name, const HPy *args, size_t nargs, HPy kwnames)¶
[source] Call a method of a Python object.
- Parameters
ctx – The execution context.
name – A handle to the name (a Unicode object) of the method. Must not be
HPy_NULL.args – A pointer to an array of the arguments. The receiver is
args[0], and the positional and keyword arguments are starting atargs[1]. This argument must not beNULLsince a receiver is always required.nargs – The number of positional arguments in
argsincluding the receiver atargs[0](therefore,nargsmust be at least1).kwnames – A handle to the tuple of keyword argument names (may be
HPy_NULL). The values of the keyword arguments are also passed inargsappended to the positional arguments. Argumentnargsdoes not include the keyword argument count.
- Returns
The result of the call on success, or
HPy_NULLin case of an error.
-
HPy
HPy_CallTupleDict(HPyContext *ctx, HPy callable, HPy args, HPy kw)¶
[source] Call a Python object.
- Parameters
ctx – The execution context.
callable – A handle to the Python object to call (must not be
HPy_NULL).args – A handle to a tuple containing the positional arguments (must not be
HPy_NULLbut can, of course, be empty).kw – A handle to a Python dictionary containing the keyword arguments (may be
HPy_NULL).
- Returns
The result of the call on success, or
HPy_NULLin case of an error.