fix bug calling search_exact() without passing end_index

This commit is contained in:
Tal Einat 2019-02-01 14:17:02 +02:00
parent 3af23d3a60
commit 05f33c4337
1 changed files with 4 additions and 1 deletions

View File

@ -154,9 +154,12 @@ else:
_search_exact = search_exact
@wraps(_search_exact)
def search_exact(subsequence, sequence, start_index=0, end_index=None):
if end_index is None:
end_index = len(sequence)
try:
return search_exact_byteslike(subsequence, sequence,
start_index, end_index if end_index is not None else -1)
start_index, end_index)
except (TypeError, UnicodeEncodeError):
return _search_exact(subsequence, sequence, start_index, end_index)