diff Python/bltinmodule.c @ 6318:cdc5a40fcf97 legacy-trunk

Introduce PyExc_Exception as the conceptual root class for all exceptions.
author Guido van Rossum <guido@python.org>
date Tue, 16 Sep 1997 18:43:15 +0000
parents 4279f4eb210a
children b0183994021b
line wrap: on
line diff
--- a/Python/bltinmodule.c	Tue Sep 16 18:42:04 1997 +0000
+++ b/Python/bltinmodule.c	Tue Sep 16 18:43:15 1997 +0000
@@ -1724,6 +1724,7 @@
 
 /* Predefined exceptions */
 
+PyObject *PyExc_Exception;
 PyObject *PyExc_StandardError;
 PyObject *PyExc_NumberError;
 PyObject *PyExc_LookupError;
@@ -1757,6 +1758,7 @@
 	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 @@
 		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");