diff Include/pyerrors.h @ 6146:a2a1df0ca808 legacy-trunk

Three new C API functions: - int PyErr_GivenExceptionMatches(obj1, obj2) Returns 1 if obj1 and obj2 are the same object, or if obj1 is an instance of type obj2, or of a class derived from obj2 - int PyErr_ExceptionMatches(obj) Higher level wrapper around PyErr_GivenExceptionMatches() which uses PyErr_Occurred() as obj1. This will be the more commonly called function. - void PyErr_NormalizeException(typeptr, valptr, tbptr) Normalizes exceptions, and places the normalized values in the arguments. If type is not a class, this does nothing. If type is a class, then it makes sure that value is an instance of the class by: 1. if instance is of the type, or a class derived from type, it does nothing. 2. otherwise it instantiates the class, using the value as an argument. If value is None, it uses an empty arg tuple, and if the value is a tuple, it uses just that.
author Barry Warsaw <barry@python.org>
date Fri, 22 Aug 1997 21:22:58 +0000
parents 0e60de2a42af
children 3a6b7a377dc3
line wrap: on
line diff
--- a/Include/pyerrors.h	Fri Aug 22 21:14:38 1997 +0000
+++ b/Include/pyerrors.h	Fri Aug 22 21:22:58 1997 +0000
@@ -45,6 +45,12 @@
 void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
 void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
 
+/* Error testing and normalization */
+int PyErr_GivenExceptionMatches Py_PROTO((PyObject *, PyObject *));
+int PyErr_ExceptionMatches Py_PROTO((PyObject *));
+void PyErr_NormalizeException Py_PROTO((PyObject**, PyObject**, PyObject**));
+
+
 /* Predefined exceptions */
 
 extern DL_IMPORT(PyObject *) PyExc_AccessError;