Skip to content

Commit 1fb518a

Browse files
committed
revert assertion order
1 parent fafadb5 commit 1fb518a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/stringlib/fastsearch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,12 @@ STRINGLIB(_two_way)(const STRINGLIB_CHAR *haystack, Py_ssize_t len_haystack,
476476
if (needle[i] != window[i]) {
477477
if (i < gap_jump_end) {
478478
LOG("Early right half mismatch: jump by gap.\n");
479-
assert(i < gap + cut);
479+
assert(gap >= i - cut + 1);
480480
window_last += gap;
481481
}
482482
else {
483483
LOG("Late right half mismatch: jump by n (>gap)\n");
484-
assert(i >= gap + cut);
484+
assert(i - cut + 1 > gap);
485485
window_last += i - cut + 1;
486486
}
487487
goto windowloop;

0 commit comments

Comments
 (0)