Add more mapping functions to c-api - #8169
Conversation
|
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: π Files selected for processing (1)
π§ Files skipped from review as they are similar to previous changes (1)
π WalkthroughWalkthroughAdds exported mapping C-API wrappers for check, length, lookup, key-existence, and string-key assignment. String-key paths decode C strings as UTF-8, convert invalid keys into VM ChangesMapping C-API additions
Estimated review effortπ― 4 (Complex) | β±οΈ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
π₯ Pre-merge checks | β 5β Passed checks (5 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
π€ Prompt for all review comments with AI agents
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/capi/src/abstract_/mapping.rs`:
- Around line 137-140: PyMapping_HasKeyString currently propagates invalid UTF-8
as a ValueError via the CStr::from_ptr(...).to_str() conversion in mapping.rs,
which violates the C API contract. Update the PyMapping_HasKeyString path to
treat UTF-8 decode failures as a silent miss by returning Ok(false) immediately
instead of mapping the error into vm.new_value_error, while keeping the existing
obj.get_item(key, vm).is_ok() behavior for valid keys.
πͺ Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: b25ba3c3-1271-4bac-aca3-25878e574cad
π Files selected for processing (1)
crates/capi/src/abstract_/mapping.rs
3b5e313 to
94cee7f
Compare
Summary by CodeRabbit
*WithErrorvariants for precise failure handling, including defined behavior for invalid UTF-8 input.