summaryrefslogtreecommitdiffstats
path: root/Python/exceptions.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-12-15 21:58:29 (GMT)
committerGuido van Rossum <guido@python.org>2000-12-15 21:58:29 (GMT)
commitd0977cd6707735e7918d185f30f6aa1253be9459 (patch)
treecf1d7aa2d15411e8e0913f7b8ecd7dd0290d9752 /Python/exceptions.c
parent3fc30372c71b5e6885fd617ad68fc119a09dd5a4 (diff)
downloadcpython-d0977cd6707735e7918d185f30f6aa1253be9459.zip
cpython-d0977cd6707735e7918d185f30f6aa1253be9459.tar.gz
cpython-d0977cd6707735e7918d185f30f6aa1253be9459.tar.bz2
Add definitions for standard warning category classes (PyExc_Warning
etc.).
Diffstat (limited to 'Python/exceptions.c')
-rw-r--r--Python/exceptions.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/Python/exceptions.c b/Python/exceptions.c
index a95817c..1bc9cdd 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -830,6 +830,8 @@ PyMethodDef SyntaxError_methods[] = {
+/* Exception doc strings */
+
static char
AssertionError__doc__[] = "Assertion failed.";
@@ -876,6 +878,25 @@ IndentationError__doc__[] = "Improper indentation.";
static char
TabError__doc__[] = "Improper mixture of spaces and tabs.";
+/* Warning category docstrings */
+
+static char
+Warning__doc__[] = "Base class for warning categories.";
+
+static char
+UserWarning__doc__[] = "Base class for warnings generated by user code.";
+
+static char
+DeprecationWarning__doc__[] =
+"Base class for warnings about deprecated features.";
+
+static char
+SyntaxWarning__doc__[] = "Base class for warnings about dubious syntax.";
+
+static char
+RuntimeWarning__doc__[] =
+"Base class for warnings about dubious runtime behavior.";
+
/* module global functions */
@@ -928,6 +949,13 @@ PyObject *PyExc_WindowsError;
*/
PyObject *PyExc_MemoryErrorInst;
+/* Predefined warning categories */
+PyObject *PyExc_Warning;
+PyObject *PyExc_UserWarning;
+PyObject *PyExc_DeprecationWarning;
+PyObject *PyExc_SyntaxWarning;
+PyObject *PyExc_RuntimeWarning;
+
/* mapping between exception names and their PyObject ** */
@@ -992,6 +1020,14 @@ static struct {
{"UnicodeError", &PyExc_UnicodeError, &PyExc_ValueError, UnicodeError__doc__},
{"SystemError", &PyExc_SystemError, 0, SystemError__doc__},
{"MemoryError", &PyExc_MemoryError, 0, MemoryError__doc__},
+ /* Warning categories */
+ {"Warning", &PyExc_Warning, &PyExc_Exception, Warning__doc__},
+ {"UserWarning", &PyExc_UserWarning, &PyExc_Warning, UserWarning__doc__},
+ {"DeprecationWarning", &PyExc_DeprecationWarning, &PyExc_Warning,
+ DeprecationWarning__doc__},
+ {"SyntaxWarning", &PyExc_SyntaxWarning, &PyExc_Warning, SyntaxWarning__doc__},
+ {"RuntimeWarning", &PyExc_RuntimeWarning, &PyExc_Warning,
+ RuntimeWarning__doc__},
/* Sentinel */
{NULL}
};