mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue 13496: Fix bisect.bisect overflow bug for large collections.
This commit is contained in:
parent
18e3d81f96
commit
a13b109bc0
3 changed files with 18 additions and 2 deletions
|
@ -122,6 +122,13 @@ class TestBisect(unittest.TestCase):
|
|||
self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3),
|
||||
self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3),
|
||||
|
||||
def test_large_range(self):
|
||||
# Issue 13496
|
||||
mod = self.module
|
||||
data = range(sys.maxsize-1)
|
||||
self.assertEqual(mod.bisect_left(data, sys.maxsize-3), sys.maxsize-3)
|
||||
self.assertEqual(mod.bisect_right(data, sys.maxsize-3), sys.maxsize-2)
|
||||
|
||||
def test_random(self, n=25):
|
||||
from random import randrange
|
||||
for i in range(n):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue