| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting. Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: c78cfb84-650e-4669-a963-44ea79616fb2 📥 CommitsReviewing files that changed from the base of the PR and between d127606 and 4aa281a. 📒 Files selected for processing (16)
📝 Walkthrough WalkthroughThe change introduces shared embedded-NUL error types and helpers, updates Rust error conversions, and replaces hard-coded or generic NUL-related exceptions across VM and standard-library paths. ChangesEmbedded-NUL exception standardization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: shaharnaveh 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
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. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
There was a problem hiding this comment.
I haven't realized it duplicated like that. tysm!
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)crates/vm/src/stdlib/time.rs (1)🤖 Prompt for all review comments with AI agents571-578: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Use a helper closure to deduplicate the ASCII buffer flush logic.
The logic for flushing ascii to out is duplicated three times. Consider extracting it into a closure to improve maintainability.
♻️ Proposed refactorlet mut out = Wtf8Buf::new(); let mut ascii = String::new(); + let mut flush_ascii = |ascii: &mut String, out: &mut Wtf8Buf| -> PyResult<()> { + if !ascii.is_empty() { + let part = + host_time::strftime_ascii(ascii, &tm).map_err(|e| e.to_pyexception(vm))?; + out.extend(part.chars()); + ascii.clear(); + } + Ok(()) + }; + for codepoint in format.as_wtf8().code_points() { if codepoint.to_u32() == 0 { - if !ascii.is_empty() { - let part = - host_time::strftime_ascii(&ascii, &tm).map_err(|e| e.to_pyexception(vm))?; - out.extend(part.chars()); - ascii.clear(); - } + flush_ascii(&mut ascii, &mut out)?; out.push(codepoint); continue; } if let Some(ch) = codepoint.to_char() && ch.is_ascii() { ascii.push(ch); continue; } - if !ascii.is_empty() { - let part = - host_time::strftime_ascii(&ascii, &tm).map_err(|e| e.to_pyexception(vm))?; - out.extend(part.chars()); - ascii.clear(); - } + flush_ascii(&mut ascii, &mut out)?; out.push(codepoint); } - if !ascii.is_empty() { - let part = host_time::strftime_ascii(&ascii, &tm).map_err(|e| e.to_pyexception(vm))?; - out.extend(part.chars()); - } + flush_ascii(&mut ascii, &mut out)?; Ok(out.to_pyobject(vm))Also applies to: 589-598
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/vm/src/stdlib/time.rs` around lines 571 - 578, In the time-formatting loop, extract the repeated non-empty `ascii` buffer flush into a local helper closure that calls `host_time::strftime_ascii`, extends `out`, and clears `ascii`; replace all three duplicated flush blocks with this closure while preserving error propagation and existing output behavior.
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@crates/vm/src/stdlib/nt.rs`: - Line 555: Update the error return in the null-character handling path to call nul_char_error through its fully qualified exceptions module path and pass the in-scope vm argument. In `@crates/vm/src/stdlib/winsound.rs`: - Line 145: Update the error return in the winsound function to reference the exceptions module through its fully qualified path, preserving the existing nul_char_error(vm) behavior without adding an import. --- Nitpick comments: In `@crates/vm/src/stdlib/time.rs`: - Around line 571-578: In the time-formatting loop, extract the repeated non-empty `ascii` buffer flush into a local helper closure that calls `host_time::strftime_ascii`, extends `out`, and clears `ascii`; replace all three duplicated flush blocks with this closure while preserving error propagation and existing output behavior.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 9bbc6a49-f35c-4f0b-b376-cd49a5c8e422
📥 CommitsReviewing files that changed from the base of the PR and between cc30cd5 and 31b6e13.
📒 Files selected for processing (15)
Sorry, something went wrong.
|
Additionally, MissingNulTerminator now raises an exception with the correct message. The original message was "embedded null character," but the error is for byte slices that lack any NULs. |
Sorry, something went wrong.
|
See #8343 for info on the Ubuntu failure. |
Sorry, something went wrong.
Part of RustPython#8245 to reduce the amount of work needed to review. I simplified the embedded nul errors by forwarding to the implementations in `vm::exceptions`.
There was a problem hiding this comment.
great, looking a lot better. thank you!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Part of #8245 to reduce the amount of work needed to review. I simplified the embedded nul errors by forwarding to the implementations in vm::exceptions.
Summary
Summary by CodeRabbit