Commit 2cb30f2
gh-152033: Use a leading category as the INFO charset prefix
_get_charset_prefix() did not recognize a leading bare CATEGORY opcode,
so a pattern starting with a category escape (such as ``\d``) lost its
SRE_INFO_CHARSET prefix and search() could no longer skip non-matching
start positions -- a regression relative to the IN-wrapped form. Handle
CATEGORY there too, which restores the charset-prefix optimization and
makes search() of category-prefixed patterns up to ~1.9x faster.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent b1e246c commit 2cb30f2
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
| 498 | + | |
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| |||
0 commit comments