mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue 3301: Bisect functions behaved badly when lo was negative.
This commit is contained in:
parent
d2cd86ddd5
commit
3cd1e42dca
4 changed files with 27 additions and 0 deletions
|
|
@ -9,6 +9,8 @@ def insort_right(a, x, lo=0, hi=None):
|
|||
slice of a to be searched.
|
||||
"""
|
||||
|
||||
if lo < 0:
|
||||
raise ValueError('lo must be non-negative')
|
||||
if hi is None:
|
||||
hi = len(a)
|
||||
while lo < hi:
|
||||
|
|
@ -30,6 +32,8 @@ def bisect_right(a, x, lo=0, hi=None):
|
|||
slice of a to be searched.
|
||||
"""
|
||||
|
||||
if lo < 0:
|
||||
raise ValueError('lo must be non-negative')
|
||||
if hi is None:
|
||||
hi = len(a)
|
||||
while lo < hi:
|
||||
|
|
@ -49,6 +53,8 @@ def insort_left(a, x, lo=0, hi=None):
|
|||
slice of a to be searched.
|
||||
"""
|
||||
|
||||
if lo < 0:
|
||||
raise ValueError('lo must be non-negative')
|
||||
if hi is None:
|
||||
hi = len(a)
|
||||
while lo < hi:
|
||||
|
|
@ -69,6 +75,8 @@ def bisect_left(a, x, lo=0, hi=None):
|
|||
slice of a to be searched.
|
||||
"""
|
||||
|
||||
if lo < 0:
|
||||
raise ValueError('lo must be non-negative')
|
||||
if hi is None:
|
||||
hi = len(a)
|
||||
while lo < hi:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue