Summary
mmap.rfind(b"") returns the start of the search range instead of its end.
Both find() and rfind() also report a match for an empty subsequence
when start > end.
Reproduced on RustPython main at 0ba7048ac, compared with CPython 3.14.7.
Reproducer
import mmap
with mmap.mmap(-1, 3) as m:
m[:] = b"abc"
print(m.rfind(b""))
print(m.rfind(b"", 1, 2))
print(m.find(b"", 2, 1))
print(m.rfind(b"", 2, 1))
Expected (CPython 3.14.7)
Actual (RustPython)
Reference
https://docs.python.org/3/library/mmap.html#mmap.mmap.rfind
Summary
mmap.rfind(b"")returns the start of the search range instead of its end.Both
find()andrfind()also report a match for an empty subsequencewhen
start > end.Reproduced on RustPython main at
0ba7048ac, compared with CPython 3.14.7.Reproducer
Expected (CPython 3.14.7)
Actual (RustPython)
Reference
https://docs.python.org/3/library/mmap.html#mmap.mmap.rfind