Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r82632:8d422c65fe9a Date: 2016-02-27 16:52 +0100 http://bitbucket.org/pypy/pypy/changeset/8d422c65fe9a/
Log: remove a guard from str.count 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