Repository navigation
Align mmap operations and capability reporting with Python 3.15 - #9141
Conversation
Separate raw descriptor inspection from owned tracking, update flush and naming behavior, and expose resize only on implemented backends. Migrate canonical mmap tests using update_lib while preserving existing RustPython guards. Assisted-by: OpenAI Codex:model version unavailable
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters: 1
📒 Files selected for processing: 2
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: :4: SyntaxWarning: invalid decimal literal dependencies:
dependent tests: (97 tests)
[ ] lib: cpython/Lib/json dependencies:
dependent tests: (14 tests)
[x] test: cpython/Lib/test/test_mmap.py (TODO: 19) dependencies: dependent tests: (2 tests)
Legend:
|
Merging this PR will not alter performance
Comparing Footnotes
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9df652854d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Try to seek to negative position... | ||
| self.assertRaises(ValueError, m.seek, -len(m)-1, 2) | ||
|
|
||
| @unittest.skipUnless(hasattr(mmap.mmap, 'resize'), 'requires mmap.resize') |
There was a problem hiding this comment.
Replace the resize skip with an expected failure
On Darwin and other targets where mmap.resize is intentionally absent, this decorator suppresses the test for an ordinary missing-feature failure; running the body would only raise an exception, not terminate or hang the process. Use the repository's conditional expected-failure marker so a later implementation is reported as an unexpected pass, since skips are reserved for process-killing cases.
AGENTS.md reference: AGENTS.md:L98-L101
Useful? React with 👍 / 👎.
| if close_original_fd: | ||
| f.close() | ||
| self.assertEqual(len(m), size) | ||
| with self.assertRaises(ValueError): |
There was a problem hiding this comment.
Restore the original trackfd assertion
In the trackfd=False case this changes the test oracle from OSError/EBADF to ValueError, rather than changing only an allowed expected-failure marker. The repository explicitly forbids modifying test assertions, logic, or data, so keep the test body unchanged and make the Rust implementation satisfy the existing assertion instead.
AGENTS.md reference: AGENTS.md:L273-L280
Useful? React with 👍 / 👎.
Summary
SystemErroron other Unix targets. CPython final omits resize whenMS_WINDOWS || HAVE_MREMAPis false; this matches Darwin's unsupported capability without adding test skips.Lib/test/test_mmap.pyusing actualscripts/update_lib migrateagainst CPython v3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc), preserving existing RustPython guards. No hand-edited Lib changes or new snippets.This is a three-file host/native/canonical-test batch. It does not adopt the separate storage/GC redesign in #8939.
Validation
threading,stdlib,stdio,importlib,host_env, one build job).-D warnings.test_trackfd_parameter,test_trackfd_neg1,test_bad_file_desc,test_flush_parameters,test_resize, andtest_set_name. No skips or expected failures occurred.-S -B, assertions enabled, C locale, a 30-second timeout plus 5-second kill grace, 1-GiB address-space limit, and 256-KiB combined output cap. Maximum selected mapping was three pages, with page size capped at 64 KiB.Coverage limits
Darwin method availability is source-reviewed, not locally runtime-verified. Windows runtime and cross-target compilation were not performed. Android/NetBSD native remapping backends remain unsupported here; this is not a full cross-platform parity claim. Existing anonymous-map flags/protection limitations and the conservative shared-anonymous growth restriction remain.
The naming test ran in normal release mode, not development mode, and therefore does not establish actual kernel VMA naming. No zero-size resize, forced remap failure, post-failure memory access, reentrancy/stress, full mmap suite, full Rust workspace, or CAPI test run was performed. In particular, truncation followed by failed remapping retains its existing hazard and is not claimed solved by this PR.
The reference's initial isolated support import stopped before tests because generated sysconfig data was absent; rerunning with a hash-verified copy of the actual build-generated literal configuration passed all six cases. The reference build retains its documented out-of-tree
-dirtybanner metadata caveat; pinned source and library provenance were verified.Implementation and validation were assisted by OpenAI Codex.