RE: Seg fault from PyArg_ParseTuple

Hammond, Mark (MHammond@jm.cmutual.com.au)
Fri, 07 Apr 95 08:06:00 PDT

>I am getting a seg fault in PyArg_ParseTuple when I give no arguments
>to a method I have written in C. The offending line is:
>
>ok = PyArg_ParseTuple(args, "Os", &mything, &switches);

PyArg_ParseTuplue assumes a valid paramater is always passed - ie, an empty
tuple. You can use PyArg_ParseTuple to grab a methods arguments only of the
3 element of the method structure in the method table is 1.

If you are just trying to pull apart another object that is not a tuple, you
need to use PyArg_Parse (?? getargs()).

If you have no idea what sort of object you have, and you need to know
specifically, you have no real choice other than an "if PyString_Check()
else if PyTuple_Check etc"

Hope this helps...

Mark.