[Python-Dev] Exception needed: Not enough arguments to PyArg_ParseTuple

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 15 00:11:22 CET 2005

Edward C. Jones wrote:
> I had
> PyArg_ParseTuple(args, "s#s#i:compare", &p1, &bytes1, &p2, &bytes2)
> in a program. There are not enough arguments to PyArg_ParseTuple. Does 
> PyArg_ParseTuple know how many arguments it is getting?

No. There is no standard way for a C function to find out how
many parameters it has been passed, and most C implementations
don't provide any way at all. That's why the calling interface
to varargs functions invariably includes some way for the caller
to indicate the number of arguments, such as a format string or
a terminating NULL.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list