• Home
  • Raw
  • Download

Lines Matching +full:is +full:- +full:callable

12 ----------------------
14 Instances of classes that set :c:member:`~PyTypeObject.tp_call` are callable.
15 The signature of the slot is::
17 PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);
19 A call is made using a tuple for the positional arguments
21 ``callable(*args, **kwargs)`` in Python code.
22 *args* must be non-NULL (use an empty tuple if there are no arguments)
25 This convention is not only used by *tp_call*:
30 :ref:`call API <capi-call>`.
36 -----------------------
44 if the callable supports it. However, this is not a hard rule.
45 Additionally, some third-party extensions use *tp_call* directly
49 Moreover, the callable must behave the same
50 regardless of which protocol is used.
51 The recommended way to achieve this is by setting
62 the arguments to an args tuple and kwargs dict anyway, then there is no point
69 This is a pointer to a function with the following signature:
71 .. c:type:: PyObject *(*vectorcallfunc)(PyObject *callable, PyObject *const *args, size_t nargsf, P…
73 - *callable* is the object being called.
74 - *args* is a C array consisting of the positional arguments followed by the
77 - *nargsf* is the number of positional arguments plus possibly the
81 - *kwnames* is a tuple containing the names of the keyword arguments;
89 If this flag is set in a vectorcall *nargsf* argument, the callee is allowed
90 to temporarily change ``args[-1]``. In other words, *args* points to
92 The callee must restore the value of ``args[-1]`` before returning.
102 To call an object that implements vectorcall, use a :ref:`call API <capi-call>`
103 function as with any other callable.
117 The old names are still defined as aliases of the new, non-underscored names.
128 For efficiency, this is not the case for calls done using vectorcall:
156 This is mostly useful to check whether or not *op* supports vectorcall,
161 .. c:function:: PyObject* PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict)
163 Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword
166 This is a specialized function, intended to be put in the
174 .. _capi-call:
177 ------------------
188 +------------------------------------------+------------------+--------------------+---------------+
189 | Function | callable | args | kwargs |
192 +------------------------------------------+------------------+--------------------+---------------+
193 | :c:func:`PyObject_CallNoArgs` | ``PyObject *`` | --- | --- |
194 +------------------------------------------+------------------+--------------------+---------------+
195 | :c:func:`PyObject_CallOneArg` | ``PyObject *`` | 1 object | --- |
196 +------------------------------------------+------------------+--------------------+---------------+
197 | :c:func:`PyObject_CallObject` | ``PyObject *`` | tuple/``NULL`` | --- |
198 +------------------------------------------+------------------+--------------------+---------------+
199 | :c:func:`PyObject_CallFunction` | ``PyObject *`` | format | --- |
200 +------------------------------------------+------------------+--------------------+---------------+
201 | :c:func:`PyObject_CallMethod` | obj + ``char*`` | format | --- |
202 +------------------------------------------+------------------+--------------------+---------------+
203 | :c:func:`PyObject_CallFunctionObjArgs` | ``PyObject *`` | variadic | --- |
204 +------------------------------------------+------------------+--------------------+---------------+
205 | :c:func:`PyObject_CallMethodObjArgs` | obj + name | variadic | --- |
206 +------------------------------------------+------------------+--------------------+---------------+
207 | :c:func:`PyObject_CallMethodNoArgs` | obj + name | --- | --- |
208 +------------------------------------------+------------------+--------------------+---------------+
209 | :c:func:`PyObject_CallMethodOneArg` | obj + name | 1 object | --- |
210 +------------------------------------------+------------------+--------------------+---------------+
212 +------------------------------------------+------------------+--------------------+---------------+
214 +------------------------------------------+------------------+--------------------+---------------+
216 +------------------------------------------+------------------+--------------------+---------------+
219 .. c:function:: PyObject* PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
221 Call a callable Python object *callable*, with arguments given by the
230 This is the equivalent of the Python expression:
231 ``callable(*args, **kwargs)``.
234 .. c:function:: PyObject* PyObject_CallNoArgs(PyObject *callable)
236 Call a callable Python object *callable* without any arguments. It is the
237 most efficient way to call a callable Python object without any argument.
245 .. c:function:: PyObject* PyObject_CallOneArg(PyObject *callable, PyObject *arg)
247 Call a callable Python object *callable* with exactly 1 positional argument
256 .. c:function:: PyObject* PyObject_CallObject(PyObject *callable, PyObject *args)
258 Call a callable Python object *callable*, with arguments given by the
264 This is the equivalent of the Python expression: ``callable(*args)``.
267 .. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...)
269 Call a callable Python object *callable*, with a variable number of C arguments.
276 This is the equivalent of the Python expression: ``callable(*args)``.
279 :c:func:`PyObject_CallFunctionObjArgs` is a faster alternative.
296 This is the equivalent of the Python expression:
300 :c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
306 .. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ...)
308 Call a callable Python object *callable*, with a variable number of
315 This is the equivalent of the Python expression:
316 ``callable(arg1, arg2, ...)``.
321 Call a method of the Python object *obj*, where the name of the method is given as a
322 Python string object in *name*. It is called with a variable number of
333 where the name of the method is given as a Python string object in *name*.
344 *arg*, where the name of the method is given as a Python string object in
353 .. c:function:: PyObject* PyObject_Vectorcall(PyObject *callable, PyObject *const *args, size_t nar…
355 Call a callable Python object *callable*.
357 If *callable* supports vectorcall_, this directly calls
358 the vectorcall function stored in *callable*.
365 .. c:function:: PyObject* PyObject_VectorcallDict(PyObject *callable, PyObject *const *args, size_t…
367 Call *callable* with positional arguments passed exactly as in the vectorcall_ protocol,
371 Regardless of which protocol is used internally,
382 is given as a Python string *name*. The object whose method is called is
385 *nargsf* is the number of positional arguments including *args[0]*,
401 ----------------
405 Determine if the object *o* is callable. Return ``1`` if the object is callable