]> granicus.if.org Git - python/commit
Untested code for 64-bit platforms. range_length() is declared as int
authorGuido van Rossum <guido@python.org>
Wed, 11 Sep 2002 15:55:48 +0000 (15:55 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 11 Sep 2002 15:55:48 +0000 (15:55 +0000)
commitd4774fb6efde8facccfe0b60a37e3ecd4a943bd9
tree2c7134cfec6a7a3bb6c23fc5de0e911a7e955166
parent02ff6a99522bf0c734831841661ebd385ae8c417
Untested code for 64-bit platforms.  range_length() is declared as int
but returns r->len which is a long.  This doesn't even cause a warning
on 32-bit platforms, but can return bogus values on 64-bit platforms
(and should cause a compiler warning).  Fix this by inserting a range
check when LONG_MAX != INT_MAX, and adding an explicit cast to (int)
when the test passes.  When r->len is out of range, PySequence_Size()
and hence len() will report an error (but an iterator will still
work).
Objects/rangeobject.c