From: Guido van Rossum Date: Mon, 27 Sep 1999 17:12:47 +0000 (+0000) Subject: Patch by Tim Peters fixing PR#88: X-Git-Tag: v1.6a1~874 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e13ff2e2d6ddc6dead2d804006d8320df27dc553;p=python Patch by Tim Peters fixing PR#88: Integer division can crash under Windows. --- diff --git a/Objects/intobject.c b/Objects/intobject.c index 7293515e6c..f2d77e1a73 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); }