/* Declared elsewhere
- PyAPI_FUNC(int) PyCallable_Check(PyObject *obj);
+ PyAPI_FUNC(int) PyCallable_Check(PyObject *o);
- Determine if the object, obj, is callable. Return 1 if the
+ Determine if the object, o, is callable. Return 1 if the
object is callable and 0 otherwise.
This function always succeeds.
*/
- PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *func,
+ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
PyObject *args, PyObject *kwargs);
#ifndef Py_LIMITED_API
_PyObject_FastCall((func), &(arg), 1)
PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func,
- PyObject *arg0, PyObject *args,
+ PyObject *obj, PyObject *args,
PyObject *kwargs);
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func,
#endif /* Py_LIMITED_API */
/*
- Call a callable Python object, func, with
+ Call a callable Python object, callable_object, with
arguments and keywords arguments. The 'args' argument can not be
NULL.
*/
- PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *func,
+ PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
PyObject *args);
/*
- Call a callable Python object, func, with
+ Call a callable Python object, callable_object, with
arguments given by the tuple, args. If no arguments are
needed, then args may be NULL. Returns the result of the
call on success, or NULL on failure. This is the equivalent
of the Python expression: o(*args).
*/
- PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *func,
+ PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
const char *format, ...);
/*
- Call a callable Python object, func, with a
+ Call a callable Python object, callable_object, with a
variable number of C arguments. The C arguments are described
using a mkvalue-style format string. The format may be NULL,
indicating that no arguments are provided. Returns the
*/
- PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
+ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o,
const char *method,
const char *format, ...);
*/
#ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
+ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *o,
_Py_Identifier *method,
const char *format, ...);
*/
#endif /* !Py_LIMITED_API */
- PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *func,
+ PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
const char *format,
...);
- PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj,
- const char *method,
+ PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
+ const char *name,
const char *format,
...);
#ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj,
- _Py_Identifier *method,
+ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *o,
+ _Py_Identifier *name,
const char *format,
...);
#endif /* !Py_LIMITED_API */
- PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *func,
+ PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
...);
/*
- Call a callable Python object, func, with a
+ Call a callable Python object, callable_object, with a
variable number of C arguments. The C arguments are provided
as PyObject * values, terminated by a NULL. Returns the
result of the call on success, or NULL on failure. This is
*/
- PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *obj,
+ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
PyObject *method, ...);
#ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *obj,
+ PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *o,
struct _Py_Identifier *method,
...);
#endif /* !Py_LIMITED_API */
/* XXX PyCallable_Check() is in object.c */
PyObject *
-PyObject_CallObject(PyObject *func, PyObject *args)
+PyObject_CallObject(PyObject *o, PyObject *a)
{
- return PyEval_CallObjectWithKeywords(func, args, NULL);
+ return PyEval_CallObjectWithKeywords(o, a, NULL);
}
PyObject*
return result;
}
-/* Positional arguments are arg0 followed args: [arg0, *args]. */
+/* Positional arguments are obj followed args. */
PyObject *
_PyObject_Call_Prepend(PyObject *func,
- PyObject *arg0, PyObject *args, PyObject *kwargs)
+ PyObject *obj, PyObject *args, PyObject *kwargs)
{
PyObject *small_stack[8];
PyObject **stack;
}
/* use borrowed references */
- stack[0] = arg0;
+ stack[0] = obj;
memcpy(&stack[1],
&PyTuple_GET_ITEM(args, 0),
argcount * sizeof(PyObject *));
}
static PyObject*
-call_function_tail(PyObject *func, PyObject *args)
+call_function_tail(PyObject *callable, PyObject *args)
{
PyObject *result;
assert(args != NULL);
if (!PyTuple_Check(args)) {
- result = _PyObject_CallArg1(func, args);
+ result = _PyObject_CallArg1(callable, args);
}
else {
- result = PyObject_Call(func, args, NULL);
+ result = PyObject_Call(callable, args, NULL);
}
return result;
}
PyObject *
-PyObject_CallFunction(PyObject *func, const char *format, ...)
+PyObject_CallFunction(PyObject *callable, const char *format, ...)
{
va_list va;
PyObject *args, *result;
- if (func == NULL) {
+ if (callable == NULL) {
return null_error();
}
if (!format || !*format) {
- return _PyObject_CallNoArg(func);
+ return _PyObject_CallNoArg(callable);
}
va_start(va, format);
return NULL;
}
- result = call_function_tail(func, args);
+ result = call_function_tail(callable, args);
Py_DECREF(args);
return result;
}
PyObject *
-_PyObject_CallFunction_SizeT(PyObject *func, const char *format, ...)
+_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...)
{
va_list va;
PyObject *args, *result;
- if (func == NULL) {
+ if (callable == NULL) {
return null_error();
}
if (!format || !*format) {
- return _PyObject_CallNoArg(func);
+ return _PyObject_CallNoArg(callable);
}
va_start(va, format);
return NULL;
}
- result = call_function_tail(func, args);
+ result = call_function_tail(callable, args);
Py_DECREF(args);
return result;
}
}
PyObject *
-PyObject_CallMethod(PyObject *obj, const char *method, const char *format, ...)
+PyObject_CallMethod(PyObject *o, const char *name, const char *format, ...)
{
va_list va;
PyObject *func = NULL;
PyObject *retval = NULL;
- if (obj == NULL || method == NULL) {
+ if (o == NULL || name == NULL) {
return null_error();
}
- func = PyObject_GetAttrString(obj, method);
- if (func == NULL) {
+ func = PyObject_GetAttrString(o, name);
+ if (func == NULL)
return NULL;
- }
va_start(va, format);
retval = callmethod(func, format, va, 0);
}
PyObject *
-_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *method,
+_PyObject_CallMethodId(PyObject *o, _Py_Identifier *name,
const char *format, ...)
{
va_list va;
- PyObject *func, *retval;
+ PyObject *func = NULL;
+ PyObject *retval = NULL;
- if (obj == NULL || method == NULL) {
+ if (o == NULL || name == NULL) {
return null_error();
}
- func = _PyObject_GetAttrId(obj, method);
- if (func == NULL) {
+ func = _PyObject_GetAttrId(o, name);
+ if (func == NULL)
return NULL;
- }
va_start(va, format);
retval = callmethod(func, format, va, 0);
}
PyObject *
-_PyObject_CallMethod_SizeT(PyObject *obj, const char *method,
+_PyObject_CallMethod_SizeT(PyObject *o, const char *name,
const char *format, ...)
{
va_list va;
- PyObject *func, *retval;
+ PyObject *func = NULL;
+ PyObject *retval;
- if (obj == NULL || method == NULL) {
+ if (o == NULL || name == NULL) {
return null_error();
}
- func = PyObject_GetAttrString(obj, method);
- if (func == NULL) {
+ func = PyObject_GetAttrString(o, name);
+ if (func == NULL)
return NULL;
- }
-
va_start(va, format);
retval = callmethod(func, format, va, 1);
va_end(va);
}
PyObject *
-_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *method,
+_PyObject_CallMethodId_SizeT(PyObject *o, _Py_Identifier *name,
const char *format, ...)
{
va_list va;
- PyObject *func, *retval;
+ PyObject *func = NULL;
+ PyObject *retval;
- if (obj == NULL || method == NULL) {
+ if (o == NULL || name == NULL) {
return null_error();
}
- func = _PyObject_GetAttrId(obj, method);
+ func = _PyObject_GetAttrId(o, name);
if (func == NULL) {
return NULL;
}
-
va_start(va, format);
retval = callmethod(func, format, va, 1);
va_end(va);
}
PyObject *
-PyObject_CallMethodObjArgs(PyObject *obj, PyObject *method, ...)
+PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...)
{
PyObject *small_stack[5];
PyObject **stack;
Py_ssize_t nargs;
- PyObject *func, *result;
+ PyObject *result;
va_list vargs;
- if (obj == NULL || method == NULL) {
+ if (callable == NULL || name == NULL) {
return null_error();
}
- func = PyObject_GetAttr(obj, method);
- if (func == NULL)
+ callable = PyObject_GetAttr(callable, name);
+ if (callable == NULL)
return NULL;
/* count the args */
- va_start(vargs, method);
+ va_start(vargs, name);
stack = objargs_mkstack(small_stack, Py_ARRAY_LENGTH(small_stack),
vargs, &nargs);
va_end(vargs);
if (stack == NULL) {
- Py_DECREF(func);
+ Py_DECREF(callable);
return NULL;
}
- result = _PyObject_FastCall(func, stack, nargs);
- Py_DECREF(func);
+ result = _PyObject_FastCall(callable, stack, nargs);
+ Py_DECREF(callable);
if (stack != small_stack) {
PyMem_Free(stack);
}
}
PyObject *
-_PyObject_CallMethodIdObjArgs(PyObject *obj,
- struct _Py_Identifier *method, ...)
+_PyObject_CallMethodIdObjArgs(PyObject *callable,
+ struct _Py_Identifier *name, ...)
{
PyObject *small_stack[5];
PyObject **stack;
Py_ssize_t nargs;
- PyObject *func, *result;
+ PyObject *result;
va_list vargs;
- if (obj == NULL || method == NULL) {
+ if (callable == NULL || name == NULL) {
return null_error();
}
- func = _PyObject_GetAttrId(obj, method);
- if (func == NULL)
+ callable = _PyObject_GetAttrId(callable, name);
+ if (callable == NULL)
return NULL;
/* count the args */
- va_start(vargs, method);
+ va_start(vargs, name);
stack = objargs_mkstack(small_stack, Py_ARRAY_LENGTH(small_stack),
vargs, &nargs);
va_end(vargs);
if (stack == NULL) {
- Py_DECREF(func);
+ Py_DECREF(callable);
return NULL;
}
- result = _PyObject_FastCall(func, stack, nargs);
- Py_DECREF(func);
+ result = _PyObject_FastCall(callable, stack, nargs);
+ Py_DECREF(callable);
if (stack != small_stack) {
PyMem_Free(stack);
}
}
PyObject *
-PyObject_CallFunctionObjArgs(PyObject *func, ...)
+PyObject_CallFunctionObjArgs(PyObject *callable, ...)
{
PyObject *small_stack[5];
PyObject **stack;
PyObject *result;
va_list vargs;
- if (func == NULL) {
+ if (callable == NULL) {
return null_error();
}
/* count the args */
- va_start(vargs, func);
+ va_start(vargs, callable);
stack = objargs_mkstack(small_stack, Py_ARRAY_LENGTH(small_stack),
vargs, &nargs);
va_end(vargs);
return NULL;
}
- result = _PyObject_FastCall(func, stack, nargs);
+ result = _PyObject_FastCall(callable, stack, nargs);
if (stack != small_stack) {
PyMem_Free(stack);
}