Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: 
Changeset: r82633:cb435db64836
Date: 2016-03-01 13:33 +0100
http://bitbucket.org/pypy/pypy/changeset/cb435db64836/

Log:    merge

diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -1076,7 +1076,7 @@
         if self is w_other.strategy:
             strategy = self
             if w_set.length() > w_other.length():
-                # swap operants
+                # swap operands
                 storage = self._intersect_unwrapped(w_other, w_set)
             else:
                 storage = self._intersect_unwrapped(w_set, w_other)
@@ -1086,7 +1086,7 @@
         else:
             strategy = self.space.fromcache(ObjectSetStrategy)
             if w_set.length() > w_other.length():
-                # swap operants
+                # swap operands
                 storage = w_other.strategy._intersect_wrapped(w_other, w_set)
             else:
                 storage = self._intersect_wrapped(w_set, w_other)
diff --git a/rpython/rtyper/lltypesystem/rstr.py 
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -717,10 +717,7 @@
             return cls.ll_count_char(s1, s2.chars[0], start, end)
 
         res = cls.ll_search(s1, s2, start, end, FAST_COUNT)
-        # For a few cases ll_search can return -1 to indicate an "impossible"
-        # condition for a string match, count just returns 0 in these cases.
-        if res < 0:
-            res = 0
+        assert res >= 0
         return res
 
     @staticmethod
@@ -741,6 +738,8 @@
         w = n - m
 
         if w < 0:
+            if mode == FAST_COUNT:
+                return 0
             return -1
 
         mlast = m - 1
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to