summaryrefslogtreecommitdiffstats
path: root/Python/exceptions.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-07-11 17:53:00 (GMT)
committerFred Drake <fdrake@acm.org>2000-07-11 17:53:00 (GMT)
commit85f363990cbd6df21015eebdc171c533176e3407 (patch)
tree4aa69857ffe21991384e379799f42ba308a58086 /Python/exceptions.c
parent88e1932930245b2f7ed300ff8b31034db7ecda5b (diff)
downloadcpython-85f363990cbd6df21015eebdc171c533176e3407.zip
cpython-85f363990cbd6df21015eebdc171c533176e3407.tar.gz
cpython-85f363990cbd6df21015eebdc171c533176e3407.tar.bz2
Create two new exceptions: IndentationError and TabError. These are
used for indentation related errors. This patch includes Ping's improvements for indentation-related error messages. Closes SourceForge patches #100734 and #100856.
Diffstat (limited to 'Python/exceptions.c')
-rw-r--r--Python/exceptions.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Python/exceptions.c b/Python/exceptions.c
index f766ba5..a70e6c6 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -68,6 +68,11 @@ Exception\n\
|\n\
+-- AttributeError\n\
+-- SyntaxError\n\
+ | |\n\
+ | +-- IndentationError\n\
+ | |\n\
+ | +-- TabError\n\
+ |\n\
+-- TypeError\n\
+-- AssertionError\n\
+-- LookupError\n\
@@ -783,6 +788,12 @@ the Python version, and the hardware/OS platform and version.";
static char
MemoryError__doc__[] = "Out of memory.";
+static char
+IndentationError__doc__[] = "Improper indentation.";
+
+static char
+TabError__doc__[] = "Improper mixture of spaces and tabs.";
+
/* module global functions */
@@ -817,6 +828,8 @@ PyObject *PyExc_OverflowError;
PyObject *PyExc_RuntimeError;
PyObject *PyExc_NotImplementedError;
PyObject *PyExc_SyntaxError;
+PyObject *PyExc_IndentationError;
+PyObject *PyExc_TabError;
PyObject *PyExc_SystemError;
PyObject *PyExc_SystemExit;
PyObject *PyExc_UnboundLocalError;
@@ -878,6 +891,10 @@ exctable[] = {
{"AttributeError", &PyExc_AttributeError, 0, AttributeError__doc__},
{"SyntaxError", &PyExc_SyntaxError, 0, SyntaxError__doc__,
SyntaxError_methods, SyntaxError__classinit__},
+ {"IndentationError", &PyExc_IndentationError, &PyExc_SyntaxError,
+ IndentationError__doc__},
+ {"TabError", &PyExc_TabError, &PyExc_IndentationError,
+ TabError__doc__},
{"AssertionError", &PyExc_AssertionError, 0, AssertionError__doc__},
{"LookupError", &PyExc_LookupError, 0, LookupError__doc__},
{"IndexError", &PyExc_IndexError, &PyExc_LookupError,