diff Python/ceval.c @ 314:e83852d1a5e2 legacy-trunk

Add interface to call a Python function (or other callable) object from C.
author Guido van Rossum <guido@python.org>
date Sat, 27 Jul 1991 21:32:34 +0000
parents ae89411f6fc0
children 449f5e5d9af6
line wrap: on
line diff
--- a/Python/ceval.c	Sat Jul 27 21:29:47 1991 +0000
+++ b/Python/ceval.c	Sat Jul 27 21:32:34 1991 +0000
@@ -1132,6 +1132,19 @@
 	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 *
 call_builtin(func, arg)
 	object *func;