From 05f33c43378a1c3e16f1d6008b3967699cd4658c Mon Sep 17 00:00:00 2001 From: Tal Einat Date: Fri, 1 Feb 2019 14:17:02 +0200 Subject: [PATCH] fix bug calling search_exact() without passing end_index --- src/fuzzysearch/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fuzzysearch/common.py b/src/fuzzysearch/common.py index e0365e9..e7363c4 100644 --- a/src/fuzzysearch/common.py +++ b/src/fuzzysearch/common.py @@ -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)