Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 83bf35c

Browse files
committed
Add interface to call a Python function (or other callable) object
from C.
1 parent 7ac4a88 commit 83bf35c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Python/ceval.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,19 @@ not(v)
11321132
return w;
11331133
}
11341134

1135+
/* External interface to call any callable object. The arg may be NULL. */
1136+
1137+
object *
1138+
call_object(func, arg)
1139+
object *func;
1140+
object *arg;
1141+
{
1142+
if (is_instancemethodobject(func) || is_funcobject(func))
1143+
return call_function(func, arg);
1144+
else
1145+
return call_builtin(func, arg);
1146+
}
1147+
11351148
static object *
11361149
call_builtin(func, arg)
11371150
object *func;

0 commit comments

Comments
 (0)