diff options
author | Guido van Rossum <guido@python.org> | 1991-12-10 14:00:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-12-10 14:00:03 (GMT) |
commit | 87e7ea72a6ef9232be9db06038943044c747971b (patch) | |
tree | 0482b0b111b4779a18f680db9a1c5bd10ca0005f /Objects/longobject.c | |
parent | 97ff5308fe3e490aac51316cf5575c6119227cc8 (diff) | |
download | cpython-87e7ea72a6ef9232be9db06038943044c747971b.zip cpython-87e7ea72a6ef9232be9db06038943044c747971b.tar.gz cpython-87e7ea72a6ef9232be9db06038943044c747971b.tar.bz2 |
Use new exceptions.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index fb5d241..37f2f35 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -168,7 +168,7 @@ getlongvalue(vv) prev = x; x = (x << SHIFT) + v->ob_digit[i]; if ((x >> SHIFT) != prev) { - err_setstr(RuntimeError, + err_setstr(ValueError, "long int too long to convert"); return -1; } @@ -422,7 +422,7 @@ long_divrem(a, b, prem) if (size_b == 0) { if (prem != NULL) *prem = NULL; - err_setstr(RuntimeError, "long division by zero"); + err_setstr(ZeroDivisionError, "long division or remainder"); return NULL; } if (size_a < size_b || @@ -938,7 +938,7 @@ long_pow(a, w) if (size_b == ~0) size_b = 0; else if (size_b < 0) { - err_setstr(RuntimeError, "long integer to the negative power"); + err_setstr(ValueError, "long integer to the negative power"); return NULL; } @@ -1054,11 +1054,11 @@ long_rshift(a, b) if (shiftby == -1L && err_occurred()) return NULL; if (shiftby < 0) { - err_setstr(RuntimeError, "negative shift count"); + err_setstr(ValueError, "negative shift count"); return NULL; } if (shiftby > MASK) { - err_setstr(RuntimeError, "outrageous shift count"); + err_setstr(ValueError, "outrageous shift count"); return NULL; } wordshift = shiftby / SHIFT; @@ -1105,11 +1105,11 @@ long_lshift(a, b) if (shiftby == -1L && err_occurred()) return NULL; if (shiftby < 0) { - err_setstr(RuntimeError, "negative shift count"); + err_setstr(ValueError, "negative shift count"); return NULL; } if (shiftby > MASK) { - err_setstr(RuntimeError, "outrageous shift count"); + err_setstr(ValueError, "outrageous shift count"); return NULL; } if (shiftby % SHIFT == 0) { |