Returning exceptions to C

Gordon McMillan gmcm at
Tue Mar 21 22:10:28 CET 2000

Developer wrote:

> I am trying to properly embed Python into a C++ program but with little
> success.  The problem I am running into is when I try to capture the raised
> exception in the C++ code.  The PyErr_Fetch() is not doing what I think it
> is.  

This is becoming a tad subjective <wink>.

> The exception is raised in the Python code and the retrun 
value is
> Py_None.  Shouldn't the PyErr_Fetch() caputer the raise exception?  Here is
> a snip ...

Py_None is a fine, upstanding return value. NULL is what you 
need to look for.

- Gordon

More information about the Python-list mailing list