[Python-checkins] CVS: python/dist/src/Include abstract.h,2.38,2.39
Fred L. Drake
fdrake@users.sourceforge.net
Fri, 26 Oct 2001 09:21:34 -0700
Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv3454/Include
Modified Files:
abstract.h
Log Message:
Added two new functions to conveniently call functions/methods from C.
PyObject_CallFunctionObArgs() and PyObject_CallMethodObArgs() have the
advantage that no format strings need to be parsed. The CallMethod
variant also avoids creating a new string object in order to retrieve
a method from an object as well.
Index: abstract.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v
retrieving revision 2.38
retrieving revision 2.39
diff -C2 -d -r2.38 -r2.39
*** abstract.h 2001/10/26 05:06:50 2.38
--- abstract.h 2001/10/26 16:21:32 2.39
***************
*** 300,304 ****
/*
-
Call a callable Python object, callable_object, with
arguments and keywords arguments. The 'args' argument can not be
--- 300,303 ----
***************
*** 311,315 ****
/*
-
Call a callable Python object, callable_object, with
arguments given by the tuple, args. If no arguments are
--- 310,313 ----
***************
*** 344,352 ****
success, or NULL on failure. This is the equivalent of the
Python expression: o.method(args).
- Note that Special method names, such as "__add__",
- "__getitem__", and so on are not supported. The specific
- abstract-object routines for these must be used.
*/
--- 342,370 ----
success, or NULL on failure. This is the equivalent of the
Python expression: o.method(args).
+ */
+ DL_IMPORT(PyObject *) PyObject_CallFunctionObArgs(PyObject *callable,
+ ...);
+
+ /*
+ Call a callable Python object, callable_object, with a
+ variable number of C arguments. The C arguments are provided
+ as PyObject * values; 'n' specifies the number of arguments
+ present. Returns the result of the call on success, or NULL
+ on failure. This is the equivalent of the Python expression:
+ apply(o,args).
+ */
+
+
+ DL_IMPORT(PyObject *) PyObject_CallMethodObArgs(PyObject *o,
+ PyObject *m, ...);
+
+ /*
+ Call the method named m of object o with a variable number of
+ C arguments. The C arguments are provided as PyObject * values;
+ 'n' specifies the number of arguments present. Returns the
+ result of the call on success, or NULL on failure. This is the
+ equivalent of the Python expression: o.method(args).
*/