On Wed, 2007-01-10 at 14:05 -0800, Huayang Xia wrote:
> I am trying to use PyObject_CallMethod. It needs a format string to
> specify what are the followed arguments. Is it possible to use a
> PyObject* as an argument?
> 
> Where can I find the spec for the format?
> 
> Thanks in advance.

See http://docs.python.org/api/object.html#l2h-247 :

Note in particular "The C arguments are described by a Py_BuildValue()
format string that should produce a tuple" and "Note that if you only
pass PyObject * args, PyObject_CallMethodObjArgs is a faster
alternative."

So, If all your arguments are PyObject pointers, use
PyObject_CallMethodObjArgs instead. Otherwise, use PyObject_CallMethod
and consult the documentation for Py_BuildValue on how to construct the
format string.

Hope this helps,

Carsten.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to