summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-16 18:43:15 +0000
committerGuido van Rossum <guido@python.org>1997-09-16 18:43:15 +0000
commit4889a53c73183041c77cd73ee13d029720dddd73 (patch)
tree33e093492c162a35e0a8368db77ec18134585c6b /Python
parent5dda075efd7e8413f06565fe8265bf0b21ce80b6 (diff)
downloadcpython-4889a53c73183041c77cd73ee13d029720dddd73.tar.gz
Introduce PyExc_Exception as the conceptual root class for all exceptions.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 251108ff49..2c858ec689 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1724,6 +1724,7 @@ static PyMethodDef builtin_methods[] = {
/* Predefined exceptions */
+PyObject *PyExc_Exception;
PyObject *PyExc_StandardError;
PyObject *PyExc_NumberError;
PyObject *PyExc_LookupError;
@@ -1757,6 +1758,7 @@ static struct
int leaf_exc;
}
bltin_exc[] = {
+ {"Exception", &PyExc_Exception, 0},
{"StandardError", &PyExc_StandardError, 0},
{"NumberError", &PyExc_NumberError, 0},
{"LookupError", &PyExc_LookupError, 0},
@@ -1901,6 +1903,11 @@ initerrors(dict)
PyTuple_SET_ITEM(PyExc_StandardError, i-1, exc);
}
PyDict_SetItemString(dict, "StandardError", PyExc_StandardError);
+
+ /* Exception is treated differently; for now, it's == StandardError */
+ PyExc_Exception = PyExc_StandardError;
+ Py_INCREF(PyExc_Exception);
+ PyDict_SetItemString(dict, "Exception", PyExc_Exception);
if (PyErr_Occurred())
Py_FatalError("Could not initialize built-in string exceptions");