mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Uniformize argument names of "call" functions
Issue #28838: Rename parameters of the "calls" functions of the Python C API. * Rename 'callable_object' and 'func' to 'callable': any Python callable object is accepted, not only Python functions * Rename 'method' and 'nameid' to 'name' (method name) * Rename 'o' to 'obj' * Move, fix and update documentation of PyObject_CallXXX() functions in abstract.h * Update also the documentaton of the C API (update parameter names)
This commit is contained in:
parent
89072047b8
commit
2d0eb65f45
7 changed files with 213 additions and 181 deletions
|
@ -244,63 +244,82 @@ Object Protocol
|
||||||
and ``0`` otherwise. This function always succeeds.
|
and ``0`` otherwise. This function always succeeds.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw)
|
.. c:function:: PyObject* PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
|
||||||
|
|
||||||
Call a callable Python object *callable_object*, with arguments given by the
|
Call a callable Python object *callable*, with arguments given by the
|
||||||
tuple *args*, and named arguments given by the dictionary *kw*. If no named
|
tuple *args*, and named arguments given by the dictionary *kwargs*.
|
||||||
arguments are needed, *kw* may be *NULL*. *args* must not be *NULL*, use an
|
|
||||||
empty tuple if no arguments are needed. Returns the result of the call on
|
*args* must not be *NULL*, use an empty tuple if no arguments are needed.
|
||||||
success, or *NULL* on failure. This is the equivalent of the Python expression
|
If no named arguments are needed, *kwargs* can be *NULL*.
|
||||||
``callable_object(*args, **kw)``.
|
|
||||||
|
Returns the result of the call on success, or *NULL* on failure.
|
||||||
|
|
||||||
|
This is the equivalent of the Python expression:
|
||||||
|
``callable(*args, **kwargs)``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args)
|
.. c:function:: PyObject* PyObject_CallObject(PyObject *callable, PyObject *args)
|
||||||
|
|
||||||
Call a callable Python object *callable_object*, with arguments given by the
|
Call a callable Python object *callable*, with arguments given by the
|
||||||
tuple *args*. If no arguments are needed, then *args* may be *NULL*. Returns
|
tuple *args*. If no arguments are needed, then *args* can be *NULL*.
|
||||||
the result of the call on success, or *NULL* on failure. This is the equivalent
|
|
||||||
of the Python expression ``callable_object(*args)``.
|
Returns the result of the call on success, or *NULL* on failure.
|
||||||
|
|
||||||
|
This is the equivalent of the Python expression: ``callable(*args)``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...)
|
.. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...)
|
||||||
|
|
||||||
Call a callable Python object *callable*, with a variable number of C arguments.
|
Call a callable Python object *callable*, with a variable number of C arguments.
|
||||||
The C arguments are described using a :c:func:`Py_BuildValue` style format
|
The C arguments are described using a :c:func:`Py_BuildValue` style format
|
||||||
string. The format may be *NULL*, indicating that no arguments are provided.
|
string. The format can be *NULL*, indicating that no arguments are provided.
|
||||||
Returns the result of the call on success, or *NULL* on failure. This is the
|
|
||||||
equivalent of the Python expression ``callable(*args)``. Note that if you only
|
Returns the result of the call on success, or *NULL* on failure.
|
||||||
pass :c:type:`PyObject \*` args, :c:func:`PyObject_CallFunctionObjArgs` is a
|
|
||||||
faster alternative.
|
This is the equivalent of the Python expression: ``callable(*args)``.
|
||||||
|
|
||||||
|
Note that if you only pass :c:type:`PyObject \*` args,
|
||||||
|
:c:func:`PyObject_CallFunctionObjArgs` is a faster alternative.
|
||||||
|
|
||||||
.. versionchanged:: 3.4
|
.. versionchanged:: 3.4
|
||||||
The type of *format* was changed from ``char *``.
|
The type of *format* was changed from ``char *``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyObject_CallMethod(PyObject *o, const char *method, const char *format, ...)
|
.. c:function:: PyObject* PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
|
||||||
|
|
||||||
Call the method named *method* of object *o* with a variable number of C
|
Call the method named *name* of object *obj* with a variable number of C
|
||||||
arguments. The C arguments are described by a :c:func:`Py_BuildValue` format
|
arguments. The C arguments are described by a :c:func:`Py_BuildValue` format
|
||||||
string that should produce a tuple. The format may be *NULL*, indicating that
|
string that should produce a tuple.
|
||||||
no arguments are provided. Returns the result of the call on success, or *NULL*
|
|
||||||
on failure. This is the equivalent of the Python expression ``o.method(args)``.
|
The format can be *NULL*, indicating that no arguments are provided.
|
||||||
|
|
||||||
|
Returns the result of the call on success, or *NULL* on failure.
|
||||||
|
|
||||||
|
This is the equivalent of the Python expression:
|
||||||
|
``obj.name(arg1, arg2, ...)``.
|
||||||
|
|
||||||
Note that if you only pass :c:type:`PyObject \*` args,
|
Note that if you only pass :c:type:`PyObject \*` args,
|
||||||
:c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
|
:c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
|
||||||
|
|
||||||
.. versionchanged:: 3.4
|
.. versionchanged:: 3.4
|
||||||
The types of *method* and *format* were changed from ``char *``.
|
The types of *name* and *format* were changed from ``char *``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL)
|
.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL)
|
||||||
|
|
||||||
Call a callable Python object *callable*, with a variable number of
|
Call a callable Python object *callable*, with a variable number of
|
||||||
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
|
: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*.
|
||||||
*NULL* on failure.
|
|
||||||
|
Returns the result of the call on success, or *NULL* on failure.
|
||||||
|
|
||||||
|
This is the equivalent of the Python expression:
|
||||||
|
``callable(arg1, arg2, ...)``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL)
|
.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *obj, PyObject *name, ..., NULL)
|
||||||
|
|
||||||
Calls a method of the object *o*, where the name of the method is given as a
|
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
|
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
|
: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*. Returns the result of the call on success, or
|
||||||
|
|
|
@ -265,14 +265,16 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
This function always succeeds.
|
This function always succeeds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
|
/* Call a callable Python object 'callable' with arguments given by the
|
||||||
PyObject *args, PyObject *kwargs);
|
tuple 'args' and keywords arguments given by the dictionary 'kwargs'.
|
||||||
|
|
||||||
/*
|
'args' must not be *NULL*, use an empty tuple if no arguments are
|
||||||
Call a callable Python object, callable_object, with
|
needed. If no named arguments are needed, 'kwargs' can be NULL.
|
||||||
arguments and keywords arguments. The 'args' argument can not be
|
|
||||||
NULL.
|
This is the equivalent of the Python expression:
|
||||||
*/
|
callable(*args, **kwargs). */
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable,
|
||||||
|
PyObject *args, PyObject *kwargs);
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject*) _PyStack_AsTuple(
|
PyAPI_FUNC(PyObject*) _PyStack_AsTuple(
|
||||||
|
@ -306,7 +308,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
PyObject **kwnames,
|
PyObject **kwnames,
|
||||||
PyObject *func);
|
PyObject *func);
|
||||||
|
|
||||||
/* Call the callable object func with the "fast call" calling convention:
|
/* Call the callable object 'callable' with the "fast call" calling convention:
|
||||||
args is a C array for positional arguments (nargs is the number of
|
args is a C array for positional arguments (nargs is the number of
|
||||||
positional arguments), kwargs is a dictionary for keyword arguments.
|
positional arguments), kwargs is a dictionary for keyword arguments.
|
||||||
|
|
||||||
|
@ -315,11 +317,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
Return the result on success. Raise an exception on return NULL on
|
Return the result on success. Raise an exception on return NULL on
|
||||||
error. */
|
error. */
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *func,
|
PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *callable,
|
||||||
PyObject **args, Py_ssize_t nargs,
|
PyObject **args, Py_ssize_t nargs,
|
||||||
PyObject *kwargs);
|
PyObject *kwargs);
|
||||||
|
|
||||||
/* Call the callable object func with the "fast call" calling convention:
|
/* Call the callable object 'callable' with the "fast call" calling convention:
|
||||||
args is a C array for positional arguments followed by values of
|
args is a C array for positional arguments followed by values of
|
||||||
keyword arguments. Keys of keyword arguments are stored as a tuple
|
keyword arguments. Keys of keyword arguments are stored as a tuple
|
||||||
of strings in kwnames. nargs is the number of positional parameters at
|
of strings in kwnames. nargs is the number of positional parameters at
|
||||||
|
@ -335,7 +337,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
Return the result on success. Raise an exception and return NULL on
|
Return the result on success. Raise an exception and return NULL on
|
||||||
error. */
|
error. */
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords
|
PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords
|
||||||
(PyObject *func,
|
(PyObject *callable,
|
||||||
PyObject **args,
|
PyObject **args,
|
||||||
Py_ssize_t nargs,
|
Py_ssize_t nargs,
|
||||||
PyObject *kwnames);
|
PyObject *kwnames);
|
||||||
|
@ -346,55 +348,54 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
#define _PyObject_CallNoArg(func) \
|
#define _PyObject_CallNoArg(func) \
|
||||||
_PyObject_FastCallDict((func), NULL, 0, NULL)
|
_PyObject_FastCallDict((func), NULL, 0, NULL)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func,
|
PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *callable,
|
||||||
PyObject *obj, PyObject *args,
|
PyObject *obj, PyObject *args,
|
||||||
PyObject *kwargs);
|
PyObject *kwargs);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func,
|
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,
|
||||||
PyObject *result,
|
PyObject *result,
|
||||||
const char *where);
|
const char *where);
|
||||||
#endif /* Py_LIMITED_API */
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
|
/* 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.
|
||||||
|
|
||||||
|
This is the equivalent of the Python expression:
|
||||||
|
callable(*args) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable,
|
||||||
PyObject *args);
|
PyObject *args);
|
||||||
|
|
||||||
/*
|
/* Call a callable Python object, callable, with a variable number of C
|
||||||
Call a callable Python object, callable_object, with
|
arguments. The C arguments are described using a mkvalue-style format
|
||||||
arguments given by the tuple, args. If no arguments are
|
string.
|
||||||
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 *callable_object,
|
The format may be NULL, indicating that no arguments are provided.
|
||||||
|
|
||||||
|
Returns the result of the call on success, or NULL on failure.
|
||||||
|
|
||||||
|
This is the equivalent of the Python expression:
|
||||||
|
callable(arg1, arg2, ...) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
|
|
||||||
/*
|
/* Call the method named 'name' of object 'obj' with a variable number of
|
||||||
Call a callable Python object, callable_object, with a
|
C arguments. The C arguments are described by a mkvalue format string.
|
||||||
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
|
|
||||||
result of the call on success, or NULL on failure. This is
|
|
||||||
the equivalent of the Python expression: o(*args).
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
The format can be NULL, indicating that no arguments are provided.
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o,
|
Returns the result of the call on success, or NULL on failure.
|
||||||
const char *method,
|
|
||||||
|
This is the equivalent of the Python expression:
|
||||||
|
obj.name(arg1, arg2, ...) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
|
||||||
|
const char *name,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
|
|
||||||
/*
|
|
||||||
Call the method named m of object o with a variable number of
|
|
||||||
C arguments. The C arguments are described by a mkvalue
|
|
||||||
format string. The format may be NULL, indicating that no
|
|
||||||
arguments are provided. Returns the result of the call on
|
|
||||||
success, or NULL on failure. This is the equivalent of the
|
|
||||||
Python expression: o.method(args).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *o,
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
|
||||||
_Py_Identifier *method,
|
_Py_Identifier *name,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -406,45 +407,46 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
|
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
|
||||||
const char *format,
|
const char *format,
|
||||||
...);
|
...);
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *format,
|
const char *format,
|
||||||
...);
|
...);
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *o,
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj,
|
||||||
_Py_Identifier *name,
|
_Py_Identifier *name,
|
||||||
const char *format,
|
const char *format,
|
||||||
...);
|
...);
|
||||||
#endif /* !Py_LIMITED_API */
|
#endif /* !Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* Call a callable Python object 'callable' 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 the equivalent of the Python expression:
|
||||||
|
callable(arg1, arg2, ...) */
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
|
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Call a callable Python object, callable_object, with a
|
Call the method named 'name' of object 'obj' with a variable number of
|
||||||
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
|
|
||||||
the equivalent of the Python expression: o(*args).
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
|
|
||||||
PyObject *method, ...);
|
|
||||||
#ifndef Py_LIMITED_API
|
|
||||||
PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *o,
|
|
||||||
struct _Py_Identifier *method,
|
|
||||||
...);
|
|
||||||
#endif /* !Py_LIMITED_API */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Call the method named m of object o with a variable number of
|
|
||||||
C arguments. The C arguments are provided as PyObject *
|
C arguments. The C arguments are provided as PyObject *
|
||||||
values, terminated by NULL. Returns the result of the call
|
values, terminated by NULL. Returns the result of the call
|
||||||
on success, or NULL on failure. This is the equivalent of
|
on success, or NULL on failure. This is the equivalent of
|
||||||
the Python expression: o.method(args).
|
the Python expression: obj.name(args).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *obj,
|
||||||
|
PyObject *name,
|
||||||
|
...);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *obj,
|
||||||
|
struct _Py_Identifier *name,
|
||||||
|
...);
|
||||||
|
#endif /* !Py_LIMITED_API */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,18 @@ extern "C" {
|
||||||
/* Interface to random parts in ceval.c */
|
/* Interface to random parts in ceval.c */
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
|
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
|
||||||
PyObject *func, PyObject *args, PyObject *kwargs);
|
PyObject *callable,
|
||||||
|
PyObject *args,
|
||||||
|
PyObject *kwargs);
|
||||||
|
|
||||||
/* Inline this */
|
/* Inline this */
|
||||||
#define PyEval_CallObject(func,arg) \
|
#define PyEval_CallObject(callable, arg) \
|
||||||
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
|
PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL)
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
|
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *callable,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
|
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
|
||||||
const char *methodname,
|
const char *name,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
|
|
|
@ -2173,24 +2173,24 @@ PyMapping_Values(PyObject *o)
|
||||||
/* XXX PyCallable_Check() is in object.c */
|
/* XXX PyCallable_Check() is in object.c */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyObject_CallObject(PyObject *o, PyObject *a)
|
PyObject_CallObject(PyObject *callable, PyObject *args)
|
||||||
{
|
{
|
||||||
return PyEval_CallObjectWithKeywords(o, a, NULL);
|
return PyEval_CallObjectWithKeywords(callable, args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
_Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where)
|
_Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where)
|
||||||
{
|
{
|
||||||
int err_occurred = (PyErr_Occurred() != NULL);
|
int err_occurred = (PyErr_Occurred() != NULL);
|
||||||
|
|
||||||
assert((func != NULL) ^ (where != NULL));
|
assert((callable != NULL) ^ (where != NULL));
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
if (!err_occurred) {
|
if (!err_occurred) {
|
||||||
if (func)
|
if (callable)
|
||||||
PyErr_Format(PyExc_SystemError,
|
PyErr_Format(PyExc_SystemError,
|
||||||
"%R returned NULL without setting an error",
|
"%R returned NULL without setting an error",
|
||||||
func);
|
callable);
|
||||||
else
|
else
|
||||||
PyErr_Format(PyExc_SystemError,
|
PyErr_Format(PyExc_SystemError,
|
||||||
"%s returned NULL without setting an error",
|
"%s returned NULL without setting an error",
|
||||||
|
@ -2206,10 +2206,10 @@ _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where)
|
||||||
if (err_occurred) {
|
if (err_occurred) {
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
|
|
||||||
if (func) {
|
if (callable) {
|
||||||
_PyErr_FormatFromCause(PyExc_SystemError,
|
_PyErr_FormatFromCause(PyExc_SystemError,
|
||||||
"%R returned a result with an error set",
|
"%R returned a result with an error set",
|
||||||
func);
|
callable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_PyErr_FormatFromCause(PyExc_SystemError,
|
_PyErr_FormatFromCause(PyExc_SystemError,
|
||||||
|
@ -2227,7 +2227,7 @@ _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyObject_Call(PyObject *func, PyObject *args, PyObject *kwargs)
|
PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
ternaryfunc call;
|
ternaryfunc call;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
@ -2239,21 +2239,21 @@ PyObject_Call(PyObject *func, PyObject *args, PyObject *kwargs)
|
||||||
assert(PyTuple_Check(args));
|
assert(PyTuple_Check(args));
|
||||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||||
|
|
||||||
call = func->ob_type->tp_call;
|
call = callable->ob_type->tp_call;
|
||||||
if (call == NULL) {
|
if (call == NULL) {
|
||||||
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
||||||
func->ob_type->tp_name);
|
callable->ob_type->tp_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Py_EnterRecursiveCall(" while calling a Python object"))
|
if (Py_EnterRecursiveCall(" while calling a Python object"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
result = (*call)(func, args, kwargs);
|
result = (*call)(callable, args, kwargs);
|
||||||
|
|
||||||
Py_LeaveRecursiveCall();
|
Py_LeaveRecursiveCall();
|
||||||
|
|
||||||
return _Py_CheckFunctionResult(func, result, NULL);
|
return _Py_CheckFunctionResult(callable, result, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject*
|
PyObject*
|
||||||
|
@ -2277,7 +2277,7 @@ _PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
|
_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
|
||||||
PyObject *kwargs)
|
PyObject *kwargs)
|
||||||
{
|
{
|
||||||
ternaryfunc call;
|
ternaryfunc call;
|
||||||
|
@ -2288,7 +2288,7 @@ _PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
|
||||||
caller loses its exception */
|
caller loses its exception */
|
||||||
assert(!PyErr_Occurred());
|
assert(!PyErr_Occurred());
|
||||||
|
|
||||||
assert(func != NULL);
|
assert(callable != NULL);
|
||||||
assert(nargs >= 0);
|
assert(nargs >= 0);
|
||||||
assert(nargs == 0 || args != NULL);
|
assert(nargs == 0 || args != NULL);
|
||||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||||
|
@ -2297,20 +2297,20 @@ _PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PyFunction_Check(func)) {
|
if (PyFunction_Check(callable)) {
|
||||||
result = _PyFunction_FastCallDict(func, args, nargs, kwargs);
|
result = _PyFunction_FastCallDict(callable, args, nargs, kwargs);
|
||||||
}
|
}
|
||||||
else if (PyCFunction_Check(func)) {
|
else if (PyCFunction_Check(callable)) {
|
||||||
result = _PyCFunction_FastCallDict(func, args, nargs, kwargs);
|
result = _PyCFunction_FastCallDict(callable, args, nargs, kwargs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyObject *tuple;
|
PyObject *tuple;
|
||||||
|
|
||||||
/* Slow-path: build a temporary tuple */
|
/* Slow-path: build a temporary tuple */
|
||||||
call = func->ob_type->tp_call;
|
call = callable->ob_type->tp_call;
|
||||||
if (call == NULL) {
|
if (call == NULL) {
|
||||||
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
||||||
func->ob_type->tp_name);
|
callable->ob_type->tp_name);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2319,10 +2319,10 @@ _PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*call)(func, tuple, kwargs);
|
result = (*call)(callable, tuple, kwargs);
|
||||||
Py_DECREF(tuple);
|
Py_DECREF(tuple);
|
||||||
|
|
||||||
result = _Py_CheckFunctionResult(func, result, NULL);
|
result = _Py_CheckFunctionResult(callable, result, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -2331,9 +2331,10 @@ exit:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Positional arguments are obj followed args. */
|
/* Positional arguments are obj followed args:
|
||||||
|
call callable(obj, *args, **kwargs) */
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_Call_Prepend(PyObject *func,
|
_PyObject_Call_Prepend(PyObject *callable,
|
||||||
PyObject *obj, PyObject *args, PyObject *kwargs)
|
PyObject *obj, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyObject *small_stack[8];
|
PyObject *small_stack[8];
|
||||||
|
@ -2361,7 +2362,7 @@ _PyObject_Call_Prepend(PyObject *func,
|
||||||
&PyTuple_GET_ITEM(args, 0),
|
&PyTuple_GET_ITEM(args, 0),
|
||||||
argcount * sizeof(PyObject *));
|
argcount * sizeof(PyObject *));
|
||||||
|
|
||||||
result = _PyObject_FastCallDict(func,
|
result = _PyObject_FastCallDict(callable,
|
||||||
stack, argcount + 1,
|
stack, argcount + 1,
|
||||||
kwargs);
|
kwargs);
|
||||||
if (stack != small_stack) {
|
if (stack != small_stack) {
|
||||||
|
@ -2452,7 +2453,7 @@ _PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_FastCallKeywords(PyObject *func, PyObject **stack, Py_ssize_t nargs,
|
_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs,
|
||||||
PyObject *kwnames)
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *kwdict, *result;
|
PyObject *kwdict, *result;
|
||||||
|
@ -2465,12 +2466,12 @@ _PyObject_FastCallKeywords(PyObject *func, PyObject **stack, Py_ssize_t nargs,
|
||||||
be unique: these are implemented in Python/ceval.c and
|
be unique: these are implemented in Python/ceval.c and
|
||||||
_PyArg_ParseStack(). */
|
_PyArg_ParseStack(). */
|
||||||
|
|
||||||
if (PyFunction_Check(func)) {
|
if (PyFunction_Check(callable)) {
|
||||||
return _PyFunction_FastCallKeywords(func, stack, nargs, kwnames);
|
return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PyCFunction_Check(func)) {
|
if (PyCFunction_Check(callable)) {
|
||||||
return _PyCFunction_FastCallKeywords(func, stack, nargs, kwnames);
|
return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nkwargs > 0) {
|
if (nkwargs > 0) {
|
||||||
|
@ -2483,7 +2484,7 @@ _PyObject_FastCallKeywords(PyObject *func, PyObject **stack, Py_ssize_t nargs,
|
||||||
kwdict = NULL;
|
kwdict = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = _PyObject_FastCallDict(func, stack, nargs, kwdict);
|
result = _PyObject_FastCallDict(callable, stack, nargs, kwdict);
|
||||||
Py_XDECREF(kwdict);
|
Py_XDECREF(kwdict);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2558,19 +2559,19 @@ _PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
callmethod(PyObject* func, const char *format, va_list va, int is_size_t)
|
callmethod(PyObject* callable, const char *format, va_list va, int is_size_t)
|
||||||
{
|
{
|
||||||
PyObject *args, *result;
|
PyObject *args, *result;
|
||||||
|
|
||||||
assert(func != NULL);
|
assert(callable != NULL);
|
||||||
|
|
||||||
if (!PyCallable_Check(func)) {
|
if (!PyCallable_Check(callable)) {
|
||||||
type_error("attribute of type '%.200s' is not callable", func);
|
type_error("attribute of type '%.200s' is not callable", callable);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!format || !*format) {
|
if (!format || !*format) {
|
||||||
return _PyObject_CallNoArg(func);
|
return _PyObject_CallNoArg(callable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_size_t) {
|
if (is_size_t) {
|
||||||
|
@ -2583,98 +2584,104 @@ callmethod(PyObject* func, const char *format, va_list va, int is_size_t)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = call_function_tail(func, args);
|
result = call_function_tail(callable, args);
|
||||||
Py_DECREF(args);
|
Py_DECREF(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyObject_CallMethod(PyObject *o, const char *name, const char *format, ...)
|
PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject *func = NULL;
|
PyObject *callable = NULL;
|
||||||
PyObject *retval = NULL;
|
PyObject *retval = NULL;
|
||||||
|
|
||||||
if (o == NULL || name == NULL) {
|
if (obj == NULL || name == NULL) {
|
||||||
return null_error();
|
return null_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
func = PyObject_GetAttrString(o, name);
|
callable = PyObject_GetAttrString(obj, name);
|
||||||
if (func == NULL)
|
if (callable == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
retval = callmethod(func, format, va, 0);
|
retval = callmethod(callable, format, va, 0);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
Py_DECREF(func);
|
|
||||||
|
Py_DECREF(callable);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_CallMethodId(PyObject *o, _Py_Identifier *name,
|
_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject *func = NULL;
|
PyObject *callable = NULL;
|
||||||
PyObject *retval = NULL;
|
PyObject *retval = NULL;
|
||||||
|
|
||||||
if (o == NULL || name == NULL) {
|
if (obj == NULL || name == NULL) {
|
||||||
return null_error();
|
return null_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
func = _PyObject_GetAttrId(o, name);
|
callable = _PyObject_GetAttrId(obj, name);
|
||||||
if (func == NULL)
|
if (callable == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
retval = callmethod(func, format, va, 0);
|
retval = callmethod(callable, format, va, 0);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
Py_DECREF(func);
|
|
||||||
|
Py_DECREF(callable);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_CallMethod_SizeT(PyObject *o, const char *name,
|
_PyObject_CallMethod_SizeT(PyObject *obj, const char *name,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject *func = NULL;
|
PyObject *callable = NULL;
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
|
|
||||||
if (o == NULL || name == NULL) {
|
if (obj == NULL || name == NULL) {
|
||||||
return null_error();
|
return null_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
func = PyObject_GetAttrString(o, name);
|
callable = PyObject_GetAttrString(obj, name);
|
||||||
if (func == NULL)
|
if (callable == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
retval = callmethod(func, format, va, 1);
|
retval = callmethod(callable, format, va, 1);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
Py_DECREF(func);
|
|
||||||
|
Py_DECREF(callable);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_CallMethodId_SizeT(PyObject *o, _Py_Identifier *name,
|
_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject *func = NULL;
|
PyObject *callable = NULL;
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
|
|
||||||
if (o == NULL || name == NULL) {
|
if (obj == NULL || name == NULL) {
|
||||||
return null_error();
|
return null_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
func = _PyObject_GetAttrId(o, name);
|
callable = _PyObject_GetAttrId(obj, name);
|
||||||
if (func == NULL) {
|
if (callable == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
retval = callmethod(func, format, va, 1);
|
retval = callmethod(callable, format, va, 1);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
Py_DECREF(func);
|
|
||||||
|
Py_DECREF(callable);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2756,20 +2763,21 @@ PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_CallMethodIdObjArgs(PyObject *callable,
|
_PyObject_CallMethodIdObjArgs(PyObject *obj,
|
||||||
struct _Py_Identifier *name, ...)
|
struct _Py_Identifier *name, ...)
|
||||||
{
|
{
|
||||||
PyObject *small_stack[5];
|
PyObject *small_stack[5];
|
||||||
PyObject **stack;
|
PyObject **stack;
|
||||||
|
PyObject *callable;
|
||||||
Py_ssize_t nargs;
|
Py_ssize_t nargs;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
va_list vargs;
|
va_list vargs;
|
||||||
|
|
||||||
if (callable == NULL || name == NULL) {
|
if (obj == NULL || name == NULL) {
|
||||||
return null_error();
|
return null_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
callable = _PyObject_GetAttrId(callable, name);
|
callable = _PyObject_GetAttrId(obj, name);
|
||||||
if (callable == NULL)
|
if (callable == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -1425,15 +1425,15 @@ _PyObject_LookupSpecial(PyObject *self, _Py_Identifier *attrid)
|
||||||
as lookup_method to cache the interned name string object. */
|
as lookup_method to cache the interned name string object. */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
call_method(PyObject *o, _Py_Identifier *nameid, const char *format, ...)
|
call_method(PyObject *obj, _Py_Identifier *name, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject *func = NULL, *retval;
|
PyObject *func = NULL, *retval;
|
||||||
|
|
||||||
func = lookup_maybe(o, nameid);
|
func = lookup_maybe(obj, name);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
if (!PyErr_Occurred())
|
if (!PyErr_Occurred())
|
||||||
PyErr_SetObject(PyExc_AttributeError, nameid->object);
|
PyErr_SetObject(PyExc_AttributeError, name->object);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1465,12 +1465,12 @@ call_method(PyObject *o, _Py_Identifier *nameid, const char *format, ...)
|
||||||
/* Clone of call_method() that returns NotImplemented when the lookup fails. */
|
/* Clone of call_method() that returns NotImplemented when the lookup fails. */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
call_maybe(PyObject *o, _Py_Identifier *nameid, const char *format, ...)
|
call_maybe(PyObject *obj, _Py_Identifier *name, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
PyObject *func = NULL, *retval;
|
PyObject *func = NULL, *retval;
|
||||||
|
|
||||||
func = lookup_maybe(o, nameid);
|
func = lookup_maybe(obj, name);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
if (!PyErr_Occurred())
|
if (!PyErr_Occurred())
|
||||||
Py_RETURN_NOTIMPLEMENTED;
|
Py_RETURN_NOTIMPLEMENTED;
|
||||||
|
|
|
@ -4637,7 +4637,8 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
|
||||||
The arg must be a tuple or NULL. The kw must be a dict or NULL. */
|
The arg must be a tuple or NULL. The kw must be a dict or NULL. */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
|
PyEval_CallObjectWithKeywords(PyObject *callable,
|
||||||
|
PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
#ifdef Py_DEBUG
|
#ifdef Py_DEBUG
|
||||||
/* PyEval_CallObjectWithKeywords() must not be called with an exception
|
/* PyEval_CallObjectWithKeywords() must not be called with an exception
|
||||||
|
@ -4647,7 +4648,7 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
return _PyObject_FastCallDict(func, NULL, 0, kwargs);
|
return _PyObject_FastCallDict(callable, NULL, 0, kwargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyTuple_Check(args)) {
|
if (!PyTuple_Check(args)) {
|
||||||
|
@ -4662,7 +4663,7 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyObject_Call(func, args, kwargs);
|
return PyObject_Call(callable, args, kwargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
|
@ -487,7 +487,7 @@ va_build_value(const char *format, va_list va, int flags)
|
||||||
|
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyEval_CallFunction(PyObject *obj, const char *format, ...)
|
PyEval_CallFunction(PyObject *callable, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list vargs;
|
va_list vargs;
|
||||||
PyObject *args;
|
PyObject *args;
|
||||||
|
@ -501,7 +501,7 @@ PyEval_CallFunction(PyObject *obj, const char *format, ...)
|
||||||
if (args == NULL)
|
if (args == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
res = PyEval_CallObject(obj, args);
|
res = PyEval_CallObject(callable, args);
|
||||||
Py_DECREF(args);
|
Py_DECREF(args);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -509,14 +509,14 @@ PyEval_CallFunction(PyObject *obj, const char *format, ...)
|
||||||
|
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...)
|
PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list vargs;
|
va_list vargs;
|
||||||
PyObject *meth;
|
PyObject *meth;
|
||||||
PyObject *args;
|
PyObject *args;
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
|
||||||
meth = PyObject_GetAttrString(obj, methodname);
|
meth = PyObject_GetAttrString(obj, name);
|
||||||
if (meth == NULL)
|
if (meth == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue