Add more object c-api's#8170
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR expands the object C-API with new attribute, deletion, comparison, hash, identity, iterator, and repr-recursion entry points. It also changes string attribute APIs to validate UTF-8 and adds ChangesObject C-API updates
Sequence Diagram(s)sequenceDiagram
participant Caller as C API caller
participant HasAttr as PyObject_HasAttrString
participant Obj as obj.has_attr
participant Unraisable as vm.run_unraisable
Caller->>HasAttr: attr_name
HasAttr->>Obj: decode UTF-8 and look up attribute
alt lookup succeeds
Obj-->>HasAttr: bool
HasAttr-->>Caller: 0 or 1
else decode or lookup fails
HasAttr->>Unraisable: report error
HasAttr-->>Caller: false
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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/object.rs`:
- Around line 324-326: The UTF-8 decode failure in the attribute-name handling
path is being swallowed by returning false directly, so invalid input is not
reported through the unraisable error flow. Update the attr-name conversion
logic in PyObject_HasAttrString/object lookup handling to detect the to_str
failure, invoke vm.run_unraisable with the conversion error, and then return
false so it matches the forgiving HasAttr behavior and does not silently drop
the error.
🪄 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: 59a6987b-4a8a-45aa-af6e-46a55d8f57c3
📒 Files selected for processing (2)
crates/capi/src/object.rscrates/capi/src/util.rs
7df5737 to
0eccf4b
Compare
0eccf4b to
640375f
Compare
Summary by CodeRabbit
New Features
Bug Fixes
ValueErrorinstead of triggering unexpected failures.falsewhile reporting the underlying error) rather than erroring unpredictably.Other