mirror of
https://github.com/python/cpython.git
synced 2025-11-20 02:50:14 +00:00
"Conceptual" merge of rev 51711 from the 2.5 branch.
i_divmod(): As discussed on Python-Dev, changed the overflow checking to live happily with recent gcc optimizations that assume signed integer arithmetic never overflows. This differs from the corresponding change on the 2.5 and 2.4 branches, using a less obscure approach, but one that /may/ tickle platform idiocies in their definitions of LONG_MIN. The 2.4 + 2.5 change avoided introducing a dependence on LONG_MIN, at the cost of substantially goofier code.
This commit is contained in:
parent
a0c95fa4d8
commit
c10c9d0d6b
2 changed files with 6 additions and 3 deletions
|
|
@ -565,7 +565,7 @@ i_divmod(register long x, register long y,
|
|||
return DIVMOD_ERROR;
|
||||
}
|
||||
/* (-sys.maxint-1)/-1 is the only overflow case. */
|
||||
if (y == -1 && x < 0 && x == -x)
|
||||
if (y == -1 && x == LONG_MIN)
|
||||
return DIVMOD_OVERFLOW;
|
||||
xdivy = x / y;
|
||||
xmody = x - xdivy * y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue