summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/intobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 7293515..f2d77e1 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -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);
}