summaryrefslogtreecommitdiffstats
path: root/Lib/bisect.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-07-10 14:03:19 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-07-10 14:03:19 (GMT)
commit3cd1e42dca01308a9f5897ba2efc2aab0bebb661 (patch)
tree8950458b1bb3e598da4dc22edbbd610ad5e75bfc /Lib/bisect.py
parentd2cd86ddd5c3d90911a98a1440563118297e45db (diff)
downloadcpython-3cd1e42dca01308a9f5897ba2efc2aab0bebb661.zip
cpython-3cd1e42dca01308a9f5897ba2efc2aab0bebb661.tar.gz
cpython-3cd1e42dca01308a9f5897ba2efc2aab0bebb661.tar.bz2
Issue 3301: Bisect functions behaved badly when lo was negative.
Diffstat (limited to 'Lib/bisect.py')
-rw-r--r--Lib/bisect.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/bisect.py b/Lib/bisect.py
index e4a2133..fe84255 100644
--- a/Lib/bisect.py
+++ b/Lib/bisect.py
@@ -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: