extending and embedding python name python exception pyexc_oserror pyexc_overflowerror pyexc_referenceerror pyexc_runtimeerror pyexc_standarderror pyexc_stopiteration pyexc_syntaxerror pyexc_systemerror pyexc_systemexit pyexc_typeerror pyexc_unicodeerror pyexc_unicodeencodeerror pyexc_unicodedecodeerror pyexc_unicodetranslateerror pyexc_valueerror pyexc_windowserror pyexc_zerodivisionerror oserror overflowerror referenceerror runtimeerror standarderror stopiteration syntaxerror systemerror systemexit typeerror unicodeerror unicodeencodeerror unicodedecodeerror unicodetranslateerror valueerror windowserror zerodivisionerror the following functions are used to query or clear the exception status of the interpretervoid pyerr_clear(clears any previously raised exceptions pyobject *pyerr_occurred(checks to see whether or not an exception has been raised if sothe current exception value is returned otherwisenull is returned int pyerr_exceptionmatches(pyobject *excchecks to see if the current exception matches the exception exc returns if true otherwise this function follows the same exception matching rules as in python code thereforeexc could be superclass of the current exception or tuple of exception classes the following prototype shows how to implement try-except block in /carry out some operation involving python objects *if (pyerr_occurred()if (pyerr_exceptionmatches(pyexc_valueerror)/take some kind of recovery action *pyerr_clear()return result/ valid pyobject *else return null/propagate the exception to the interpreter * lib fl ff