Repository navigation
Align mmap read and search arguments - #9590
Merged
youknowone merged 4 commits intoNov 6, 2026
Merged
Conversation
Distinguish a missing index slot from exceptions raised while converting an index, including overflow and interrupts. Assisted-by: OpenAI Codex:model version not exposed
Contributor
|
Caution Review failedThe pull request is closed.
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. |
Assisted-by: OpenAI Codex:model version not exposed
youknowone
requested changes
Nov 3, 2026
Comment on lines
+1124
to
+1135
| Some(obj) if !vm.is_none(&obj) => { | ||
| let index = obj.try_index_opt(vm).ok_or_else(|| { | ||
| let mut name = obj.class().slot_name().to_string(); | ||
| if name.len() > 200 { | ||
| let mut end = 200; | ||
| while !name.is_char_boundary(end) { | ||
| end -= 1; | ||
| } | ||
| name.truncate(end); | ||
| } | ||
| vm.new_type_error(format!( | ||
| "read argument must be int or None, not {}", | ||
| class.name() | ||
| "argument should be integer or None, not '{name}'" |
Apply maintainer review while preserving conversion and audit behavior. Assisted-by: OpenAI Codex:model version unavailable
Use map_or_else for the pure default bound calculation to satisfy strict Clippy. Assisted-by: OpenAI Codex:model version unavailable
youknowone
approved these changes
Nov 6, 2026
youknowone
marked this pull request as ready for review
November 6, 2026 03:35
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
mmap.read: reject non-indexable values while propagating errors from__index__and integer overflow. Keep conversion outside the mapping lock and preserve the existing safe type-name truncation.findandrfind, bind arguments before acquiring the search buffer, require the buffer protocol, and convert start followed by end only when start is notNone, as CPython 3.15 does. Check mapping validity around conversions that can run Python, and retain the original buffer export during callbacks.Validation
mmap_gfind_lock_held, including buffer lifetime, self-aliasing, reentrant close/resize, range bounds, and lock release.prek run --files crates/stdlib/src/mmap.rs, normal commit hooks, andgit diff --checkpassed.test_mmap.test_read_invalid_argand existing find/rfind cases cover related behavior; the existingtest_find_endremains skipped and therefore is not execution evidence.Scope and costs
The search path adds a validation lock, and non-bytes search buffers are snapshotted, including before a reversed-range return. This can change concurrent mutation visibility or allocation-failure timing; no benchmark was run and full free-threaded critical-section parity is not claimed. Existing signed-size overflow wording may differ, as can a diagnostic when a multibyte character crosses CPython's raw 200-byte type-name limit. No Lib or test files were modified.