Mercurial > cpython-lru_cache-weakref
diff Objects/intobject.c @ 11332:fad55eec5dfc legacy-trunk
Patch by Tim Peters fixing PR#88:
Integer division can crash under Windows.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 27 Sep 1999 17:12:47 +0000 |
| parents | 0789e0b55587 |
| children | aca7b5eaf5e8 |
line wrap: on
line diff
--- a/Objects/intobject.c Mon Sep 27 17:11:52 1999 +0000 +++ b/Objects/intobject.c Mon Sep 27 17:12:47 1999 +0000 @@ -434,8 +434,14 @@ 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); }
