Repository navigation
Retain buffer exports for regex scanners - #9455
Conversation
Assisted-by: Codex:GPT-6
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. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Buffer-aware scanner setup and operations crates/vm/src/stdlib/_sre.rs |
with_sre_str! accepts an optional buffer and uses contiguous_or_collect when a buffer is present. Pattern.scanner creates a buffer for byte patterns and validates other subjects as strings. SreScanner stores the optional buffer, which its match and search methods pass to the macro. finditer now calls Pattern.scanner. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: youknowone
Merge Risk: 
Minimal · up to b8a33
-
No actionable merge-blocking issue is established for retaining scanner buffer exports. The change is mergeable subject to normal build and test checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "Retain buffer exports for regex scanners" matches the main objective of PR
#9455, which keeps the original buffer export alive for the lifetime of a regex scanner or finditer iterator. The raw summary confirms the changes in crates/vm/src/stdlib/_sre.rs: the scanner stores a buffer, scanner match and search pass that buffer through with_sre_str!, and finditer obtains its scanner through Pattern.scanner. The title is specific and concise. It omits the validation change for non-bytes subjects, which is a secondary detail.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 1 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/re dependencies:
dependent tests: (86 tests)
Legend:
|
Summary
finditeriterator. Resizing the underlying bytearray or releasing its memoryview now raisesBufferErrorwhile the scanner is active.Performance
Scanning a bytearray containing 500 matches, measured against main at
8c6c94b07:AI assistance
Written with Codex (GPT-6), reviewed by a human before submission.
Summary by CodeRabbit
finditernow uses the same scanner creation path as other scanner operations.