Returning exceptions to C

Mark Hammond mhammond at
Thu Mar 23 00:30:37 CET 2000

In article <38d7dd10$0$10825 at>,
"Developer" <jonp at> wrote:

> is. 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 ...
> pStr = PyEval_CallObject(pFunc, pArgs);

If this fails, the result is NULL.  And as NULL != Py_None, you are
entering the "success" block.

> if (pStr != Py_None)
> {
ie, this block is entered on failure _and_ success, unless the result
is exactly None.  This block should simply say " ... != NULL"


Sent via
Before you buy.

More information about the Python-list mailing list