Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MMapCache._fetch()treated the exclusive end offset as an additional block and did not clamp oversized reads to the file size. This could mark nonexistent blocks as cached or, after the final block was already cached, send an empty/inverted range to the backend. For example, with a 10-byte file and 4-byte blocks, reading byte 8 followed by_fetch(0, 100)requested(12, 10). The same problem is reachable throughAbstractBufferedFile.read()withcache_type="mmap".endto EOF and calculate the final block fromend - 1, after the existing empty-range guard.This is the mmap counterpart of the bounds handling previously fixed for the other block caches, not a change to their prefetch policy.
Validation
Windows / dedicated Conda Python 3.13.15 environment, based on upstream
af73c654:MMapCache._fetchhas 100% statement and branch coverage.|filename tests; both were independently reproduced on an unmodified upstream export (211 other selected cases passed). A Windows HTTP-fixture teardown warning also reproduces upstream. No existing assertions or skip rules were changed.Full optional/cloud/Docker/downstream and other Python/OS CI runs are not claimed.
Prepared with OpenAI Codex assistance.