PyArg_ParseTuple exception catching

Fredrik Lundh fredrik at pythonware.com
Mon Dec 26 19:52:22 CET 2005


x0rster at gmail.com wrote:

> I'm getting an error when using PyArg_ParseTuple and I don't know
> why...In the documentation I've read that PyArg_ParseTuple raise an
> appropriate exception :
> "on failure, it returns false and raises the appropriate exception."
>
> How can I get the exception in C ? because I've checked the arguments
> before calling the C python function and I don't know why I've got a
> problem when parsing the arguments list...

the easiest way to see the exception is to return NULL, and let Python
take care of the rest.

    if (!PyArg_ParseTuple(...)):
        return NULL;

</F>






More information about the Python-list mailing list