Fix test_mmap_sparse.py to work on Windows, Mac, and Linux#40
Closed
Copilot wants to merge 1 commit into
Closed
Conversation
…ility Agent-Logs-Url: https://github.com/jeremytrimble/specview/sessions/d602e130-0dc8-4779-a4a8-3f7e7a02d53b Co-authored-by: jeremytrimble <1209303+jeremytrimble@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jeremytrimble
May 22, 2026 02:19
View session
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.
test_mmap_sparse.pypassed on Linux/Mac but failed on Windows due to two incompatible patterns in Python'smmapon Windows.Root causes
mmapobjects with different sizes on the same file handle raiseOSError(WinError 87) —CreateFileMappingrejects a second mapping of a different size from the same handle.PAGE_READWRITE) mmap is active — conflicts with Windows file-mapping semantics.Changes
"rb"file handle permmapwith explicitaccess=mmap.ACCESS_READ(PAGE_READONLY). Read-only mappings on Windows allow concurrent writes through other handles without sharing violations."r+b"write handle — mirrors the real-world pattern (background writer process / foreground reader process) and eliminates the same-handle conflict entirely.os.fsync()after each write — ensures the OS page cache is committed before a newmmapis created, needed for correctness on Windows.contextlib.ExitStack— manages all three handles and both mmap objects with safe, exception-proof cleanup.