diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/errors.c | 6 | ||||
-rw-r--r-- | Python/marshal.c | 12 | ||||
-rw-r--r-- | Python/structmember.c | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/Python/errors.c b/Python/errors.c index 70a85ba..3b7d4a1 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -180,10 +180,10 @@ err_input(err) case E_OK: break; case E_SYNTAX: - err_setstr(RuntimeError, "syntax error"); + err_setstr(ValueError, "syntax error"); break; case E_TOKEN: - err_setstr(RuntimeError, "illegal token"); + err_setstr(ValueError, "illegal token"); break; case E_INTR: err_set(KeyboardInterrupt); @@ -195,7 +195,7 @@ err_input(err) err_set(EOFError); break; default: - err_setstr(RuntimeError, "unknown input error"); + err_setstr(SystemError, "unknown input error"); break; } } diff --git a/Python/marshal.c b/Python/marshal.c index 1af49eb..d065ebe 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -191,7 +191,7 @@ rd_object(fp) switch (type) { case EOF: - err_setstr(RuntimeError, "EOF read where object expected"); + err_setstr(EOFError, "EOF read where object expected"); return NULL; case TYPE_NULL: @@ -227,7 +227,7 @@ rd_object(fp) char *end; n = rd_byte(fp); if (fread(buf, 1, (int)n, fp) != n) { - err_setstr(RuntimeError, + err_setstr(EOFError, "EOF read where object expected"); return NULL; } @@ -235,11 +235,11 @@ rd_object(fp) errno = 0; res = strtod(buf, &end); if (*end != '\0') { - err_setstr(RuntimeError, "bad float syntax"); + err_setstr(ValueError, "bad float syntax"); return NULL; } if (errno != 0) { - err_setstr(RuntimeError, + err_setstr(ValueError, "float constant too large"); return NULL; } @@ -253,7 +253,7 @@ rd_object(fp) if (fread(getstringvalue(v), 1, (int)n, fp) != n) { DECREF(v); v = NULL; - err_setstr(RuntimeError, + err_setstr(EOFError, "EOF read where object expected"); } } @@ -314,7 +314,7 @@ rd_object(fp) return v; default: - err_setstr(RuntimeError, "read unknown object"); + err_setstr(TypeError, "read unknown object"); return NULL; } diff --git a/Python/structmember.c b/Python/structmember.c index acdf9c6..bd04e7c 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -103,7 +103,7 @@ getmember(addr, mlist, name) } } - err_setstr(NameError, name); + err_setstr(AttributeError, name); return NULL; } @@ -119,7 +119,7 @@ setmember(addr, mlist, name, v) for (l = mlist; l->name != NULL; l++) { if (strcmp(l->name, name) == 0) { if (l->readonly || l->type == T_STRING) { - err_setstr(RuntimeError, "readonly attribute"); + err_setstr(TypeError, "readonly attribute"); return -1; } addr += l->offset; @@ -178,6 +178,6 @@ setmember(addr, mlist, name, v) } } - err_setstr(NameError, name); + err_setstr(AttributeError, name); return -1; } |