| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Caution Review failedThe pull request is closed. WalkthroughExposes PyStr::ensure_valid_utf8 at crate scope and adds UTF‑8 and type validations during type creation and name assignment: validates type names, __doc__, and __slots__ items and rejects bytes in __slots__. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
📜 Recent review details Configuration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📥 CommitsReviewing files that changed from the base of the PR and between 4457769 and 4184c27. 📒 Files selected for processing (2)
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 and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)crates/vm/src/builtins/type.rs (1)1359-1379: Validate __slots__ string items for UTF-8 surrogates to match validation of type name and __doc__.
The PR adds UTF-8 surrogate validation for type names (line 1166) and __doc__ (line 1315), but __slots__ string items lack this validation. Currently, slot names containing surrogates (e.g., '\ud800') would pass the bytes check and try_into_typed without validation, then propagate through mangle_name and intern_str. Calling ensure_valid_utf8 on each slot string after conversion would maintain consistency with the validation applied elsewhere.
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📥 CommitsReviewing files that changed from the base of the PR and between 27ab62d and 4457769.
⛔ Files ignored due to path filters (1)📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.rs: Follow the default rustfmt code style by running cargo fmt to format Rust code
Always run clippy to lint Rust code (cargo clippy) before completing tasks and fix any warnings or lints introduced by changes
Follow Rust best practices for error handling and memory management
Use the macro system (pyclass, pymodule, pyfunction, etc.) when implementing Python functionality in Rust
Files:
crates/vm/src/builtins/str.rs (1)crates/vm/src/builtins/type.rs (5)444-461: LGTM - Visibility change enables proper UTF-8 validation across the crate.
The pub(crate) visibility is the appropriate scope for this helper, allowing type construction paths to validate strings without exposing it publicly.
1154-1177: LGTM - Proper UTF-8 validation for type name setter.
The validation is correctly placed after the null character check, ensuring type names don't contain surrogates. This aligns with CPython's behavior.
1252-1259: LGTM - UTF-8 validation during type construction.
Correctly validates the type name immediately after the null character check, preventing type creation with surrogate-containing names.
1311-1316: LGTM - Validates __doc__ strings for surrogates during type creation.
The check correctly handles the optional nature of __doc__ - only validating when it exists and is a string.
1351-1358: LGTM - Rejects bytes as __slots__ value.
This correctly rejects __slots__ = b"foo" with an appropriate error message, matching CPython's behavior.
1366-1373: LGTM - Rejects bytes items within __slots__ iterable.
Correctly handles cases like __slots__ = ['a', b'b'] by validating each item during iteration.
Sorry, something went wrong.
|
Code has been automatically formatted The code in this PR has been formatted using cargo fmt --all. git pull origin surrogate-check |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.