Tim Peters <t...@python.org> added the comment:

BTW, this initialization in the FASTSEARCH code appears to me to be a mistake:

    skip = mlast - 1;

That's "mistake" in the sense of "not quite what was intended, and so 
confusing", not in the sense of "leads to a wrong result".

I believe `skip` should be initialized to plain `mlast` instead.  Setting it to 
something smaller than that (like to `mlast - 1`) doesn't cause an error, but 
fails to exploit as much skipping as possible.

`mlast - 1` is the same value `skip` is set to if the following loop finds that 
the last character of the pattern is also the pattern's first character, but 
doesn't appear elsewhere in the pattern. It can be one larger if the last 
pattern character is unique in the pattern (which is the initial value of 
`skip` set by the line shown above).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to