diff options
author | Guido van Rossum <guido@python.org> | 2001-01-15 18:58:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-01-15 18:58:56 (GMT) |
commit | 65e0b99b611a42fd6548b2783a234f32630e6f1b (patch) | |
tree | 9f8c3f5ee6f625cb517cd5f95501adfd33d8ce20 /Misc | |
parent | afc4f0413ae7c307207772373937b0eb1e0a645b (diff) | |
download | cpython-65e0b99b611a42fd6548b2783a234f32630e6f1b.zip cpython-65e0b99b611a42fd6548b2783a234f32630e6f1b.tar.gz cpython-65e0b99b611a42fd6548b2783a234f32630e6f1b.tar.bz2 |
SF patch #103158 by Greg Ball: Don't do unsafe arithmetic in xrange
object.
This fixes potential overflows in xrange()'s internal calculations on
64-bit platforms. The fix is complicated because the sq_length slot
function can only return an int; we want to support
xrange(sys.maxint), which is a 64-bit quantity on most 64-bit
platforms (except Win64). The solution is hacky but the best
possible: when the range is that long, we can use it in a for loop but
we can't ask for its length (nor can we actually iterate beyond
2**31-1, because the sq_item slot function has the same restrictions
on its arguments. Fixing those restrictions is a project for another
day...
Diffstat (limited to 'Misc')
0 files changed, 0 insertions, 0 deletions