mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
Add interface to call a Python function (or other callable) object
from C.
This commit is contained in:
parent
7ac4a88721
commit
83bf35cb27
1 changed files with 13 additions and 0 deletions
|
|
@ -1132,6 +1132,19 @@ not(v)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* External interface to call any callable object. The arg may be NULL. */
|
||||||
|
|
||||||
|
object *
|
||||||
|
call_object(func, arg)
|
||||||
|
object *func;
|
||||||
|
object *arg;
|
||||||
|
{
|
||||||
|
if (is_instancemethodobject(func) || is_funcobject(func))
|
||||||
|
return call_function(func, arg);
|
||||||
|
else
|
||||||
|
return call_builtin(func, arg);
|
||||||
|
}
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
call_builtin(func, arg)
|
call_builtin(func, arg)
|
||||||
object *func;
|
object *func;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue