C built and raised exceptions are not being catched in Python code

WP warrenpstma at _______.com.hotmail
Wed Feb 26 13:53:09 EST 2003


> 
> 	- If I raise the C-built exception in Python code, I can catch it in
> 	  Python or C code.

> 	- If I raise it in C code, I can only catch it in C code, the
> 	  except clause in Python code acts as if no exception was
> 	  raised.
> 
> 	Of course, I'd like to catch C raised exceptions in Python
> 	code also, but I don't see what might be failing.


What do you mean, raise exception in C? Do you mean return a NULL from a method in a C extension?
In C you have return codes of NULL. Any time you return NULL, an exception is raised. You set
the exception type (global) and return NULL.

Warren





More information about the Python-list mailing list