[pypy-svn] pypy fast-forward: bisect_left should check the lower bound as well

amauryfa commits-noreply at bitbucket.org
Tue Jan 4 01:21:00 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40366:2624cc81bb27
Date: 2011-01-04 01:23 +0100
http://bitbucket.org/pypy/pypy/changeset/2624cc81bb27/

Log:	bisect_left should check the lower bound as well

diff --git a/pypy/module/_bisect/interp_bisect.py b/pypy/module/_bisect/interp_bisect.py
--- a/pypy/module/_bisect/interp_bisect.py
+++ b/pypy/module/_bisect/interp_bisect.py
@@ -13,8 +13,7 @@
 slice of a to be searched."""
     if lo < 0:
         raise OperationError(space.w_ValueError,
-            space.wrap("lo must be non-negative")
-        )
+                             space.wrap("lo must be non-negative"))
     if hi == -1:
         hi = space.int_w(space.len(w_a))
     while lo < hi:
@@ -37,6 +36,9 @@
 
 Optional args lo (default 0) and hi (default len(a)) bound the
 slice of a to be searched."""
+    if lo < 0:
+        raise OperationError(space.w_ValueError,
+                             space.wrap("lo must be non-negative"))
     if hi == -1:
         hi = space.int_w(space.len(w_a))
     while lo < hi:


More information about the Pypy-commit mailing list