Fix zero division checks: return if it occurs!

This commit is contained in:
Guido van Rossum 1990-10-26 14:58:41 +00:00
parent dd5c7be568
commit abbda16f58
1 changed files with 3 additions and 3 deletions

View File

@ -156,7 +156,7 @@ intdiv(v, w)
return NULL;
}
if (((intobject *)w) -> ob_ival == 0)
err_zdiv();
return err_zdiv();
return newintobject(v->ob_ival / ((intobject *)w) -> ob_ival);
}
@ -170,7 +170,7 @@ intrem(v, w)
return NULL;
}
if (((intobject *)w) -> ob_ival == 0)
err_zdiv();
return err_zdiv();
return newintobject(v->ob_ival % ((intobject *)w) -> ob_ival);
}
@ -195,7 +195,7 @@ intpow(v, w)
ix = ix * iv;
if (neg) {
if (ix == 0)
err_zdiv();
return err_zdiv();
ix = 1/ix;
}
/* XXX How to check for overflow? */