summaryrefslogtreecommitdiffstats
path: root/Include/pyerrors.h
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-08-22 21:22:58 (GMT)
committerBarry Warsaw <barry@python.org>1997-08-22 21:22:58 (GMT)
commitc0dc92af7d41ecf1d60f4ab29452d7179c039d8c (patch)
tree207d717b9b91dac3b1b7a605ed2292cc87830e69 /Include/pyerrors.h
parentcde8b1ba0c0948f2cec00d11821214e06ca419cb (diff)
downloadcpython-c0dc92af7d41ecf1d60f4ab29452d7179c039d8c.zip
cpython-c0dc92af7d41ecf1d60f4ab29452d7179c039d8c.tar.gz
cpython-c0dc92af7d41ecf1d60f4ab29452d7179c039d8c.tar.bz2
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.
Diffstat (limited to 'Include/pyerrors.h')
-rw-r--r--Include/pyerrors.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index c3de80a..45e8042 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -45,6 +45,12 @@ void PyErr_Clear Py_PROTO((void));
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;