Commit e13ff2e2 authored by Guido van Rossum's avatar Guido van Rossum

Patch by Tim Peters fixing PR#88:

Integer division can crash under Windows.
parent 1a23c248
......@@ -434,8 +434,14 @@ i_divmod(x, y, p_xdivy, p_xmody)
return -1;
}
if (yi < 0) {
if (xi < 0)
if (xi < 0) {
if (yi == -1 && -xi < 0) {
/* most negative / -1 */
err_ovf("integer division");
return -1;
}
xdivy = -xi / -yi;
}
else
xdivy = - (xi / -yi);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment