Files
Luan Taraschi a72f77884d Fix str.replace with an empty pattern splitting characters (#8561)
Wtf8::replace looks for the pattern with a byte search. An empty pattern
matches at every byte, so the replacement was inserted between the bytes of
a multi-byte character and the result was no longer WTF-8:

    >>> "á".replace("", "-")
    '-ím'          # CPython: '-á-'

from_bytes_unchecked then took that as valid without looking, so every later
read of the string returned something else. An empty pattern now walks code
points instead. A pattern that is not empty stays on the byte search, which
is safe because a WTF-8 sequence never starts inside another one.

Assisted-by: Claude Code:claude-opus-5
2026-08-21 15:37:08 +09:00
..
2026-07-07 09:19:25 +09:00