summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-16 15:42:38 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-16 15:42:38 (GMT)
commitfb905c3ebfe71c619cf4a4cb8bf162beb3526db2 (patch)
treeb349ec47876b3effc29425db86b18be856eee569
parent0f1b8063b5c4afeb3cf5825c9360aa8de6f0d0ad (diff)
downloadcpython-fb905c3ebfe71c619cf4a4cb8bf162beb3526db2.zip
cpython-fb905c3ebfe71c619cf4a4cb8bf162beb3526db2.tar.gz
cpython-fb905c3ebfe71c619cf4a4cb8bf162beb3526db2.tar.bz2
Regularize exceptions.
-rwxr-xr-xInclude/errors.h20
-rw-r--r--Include/pyerrors.h20
-rw-r--r--Python/bltinmodule.c63
3 files changed, 45 insertions, 58 deletions
diff --git a/Include/errors.h b/Include/errors.h
index 4972f18..b6735a7 100755
--- a/Include/errors.h
+++ b/Include/errors.h
@@ -33,23 +33,21 @@ void err_clear PROTO((void));
/* Predefined exceptions */
-extern object *RuntimeError;
-extern object *EOFError;
-extern object *TypeError;
-extern object *MemoryError;
-extern object *NameError;
-extern object *SystemError;
-extern object *KeyboardInterrupt;
-
-/* New exceptions */
extern object *AttributeError;
+extern object *EOFError;
extern object *IOError;
-extern object *ZeroDivisionError;
extern object *IndexError;
-extern object *ValueError;
extern object *KeyError;
+extern object *KeyboardInterrupt;
+extern object *MemoryError;
+extern object *NameError;
extern object *OverflowError;
+extern object *RuntimeError;
extern object *SyntaxError;
+extern object *SystemError;
+extern object *TypeError;
+extern object *ValueError;
+extern object *ZeroDivisionError;
/* Convenience functions */
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index 4972f18..b6735a7 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -33,23 +33,21 @@ void err_clear PROTO((void));
/* Predefined exceptions */
-extern object *RuntimeError;
-extern object *EOFError;
-extern object *TypeError;
-extern object *MemoryError;
-extern object *NameError;
-extern object *SystemError;
-extern object *KeyboardInterrupt;
-
-/* New exceptions */
extern object *AttributeError;
+extern object *EOFError;
extern object *IOError;
-extern object *ZeroDivisionError;
extern object *IndexError;
-extern object *ValueError;
extern object *KeyError;
+extern object *KeyboardInterrupt;
+extern object *MemoryError;
+extern object *NameError;
extern object *OverflowError;
+extern object *RuntimeError;
extern object *SyntaxError;
+extern object *SystemError;
+extern object *TypeError;
+extern object *ValueError;
+extern object *ZeroDivisionError;
/* Convenience functions */
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 5bdf5d9..1a9bfc6 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -602,29 +602,27 @@ getbuiltin(name)
/* Predefined exceptions */
-object *RuntimeError;
-object *EOFError;
-object *TypeError;
-object *MemoryError;
-object *NameError;
-object *SystemError;
-object *KeyboardInterrupt;
-
-/* New exceptions */
object *AttributeError;
+object *EOFError;
object *IOError;
-object *ZeroDivisionError;
object *IndexError;
-object *ValueError;
object *KeyError;
+object *KeyboardInterrupt;
+object *MemoryError;
+object *NameError;
object *OverflowError;
+object *RuntimeError;
object *SyntaxError;
+object *SystemError;
+object *TypeError;
+object *ValueError;
+object *ZeroDivisionError;
static object *
-newstdexception(name, message)
- char *name, *message;
+newstdexception(name)
+ char *name;
{
- object *v = newstringobject(message);
+ object *v = newstringobject(name);
if (v == NULL || dictinsert(builtin_dict, name, v) != 0)
fatal("no mem for new standard exception");
return v;
@@ -633,28 +631,21 @@ newstdexception(name, message)
static void
initerrors()
{
- RuntimeError = newstdexception("RuntimeError", "run-time error");
- EOFError = newstdexception("EOFError", "end-of-file read");
- TypeError = newstdexception("TypeError", "type error");
- MemoryError = newstdexception("MemoryError", "out of memory");
- NameError = newstdexception("NameError", "undefined name");
- SystemError = newstdexception("SystemError", "system error");
- KeyboardInterrupt =
- newstdexception("KeyboardInterrupt", "keyboard interrupt");
-
- /* New exceptions */
- AttributeError =
- newstdexception("AttributeError", "undefined attribute");
- IOError = newstdexception("IOError", "I/O error");
- ZeroDivisionError =
- newstdexception("ZeroDivisionError", "division by zero");
- IndexError = newstdexception("IndexError", "index out of range");
- ValueError = newstdexception("ValueError", "unacceptable value");
- KeyError = newstdexception("KeyError", "invalid key");
- OverflowError =
- newstdexception("OverflowError", "arithmetic overflow");
- SyntaxError =
- newstdexception("SyntaxError", "syntax error");
+ RuntimeError = newstdexception("RuntimeError");
+ EOFError = newstdexception("EOFError");
+ TypeError = newstdexception("TypeError");
+ MemoryError = newstdexception("MemoryError");
+ NameError = newstdexception("NameError");
+ SystemError = newstdexception("SystemError");
+ KeyboardInterrupt = newstdexception("KeyboardInterrupt");
+ AttributeError = newstdexception("AttributeError");
+ IOError = newstdexception("IOError");
+ ZeroDivisionError = newstdexception("ZeroDivisionError");
+ IndexError = newstdexception("IndexError");
+ ValueError = newstdexception("ValueError");
+ KeyError = newstdexception("KeyError");
+ OverflowError = newstdexception("OverflowError");
+ SyntaxError = newstdexception("SyntaxError");
}
void