Add object protocol methods to c-api#7882
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 (1)
📝 WalkthroughWalkthroughA new FFI module adds five C-ABI extern functions that wrap PyObject operations (GetItem, SetItem, DelItem, IsSubclass, IsInstance), converting raw ChangesPyObject FFI Wrappers
sequenceDiagram
participant Caller
participant PyObject_FFI
participant VM
participant PyObject
Caller->>PyObject_FFI: PyObject_GetItem(obj, key)
PyObject_FFI->>VM: with_vm(call get_item on obj)
VM->>PyObject: get_item(key)
PyObject-->>VM: result PyObject*
VM-->>PyObject_FFI: returned pointer
PyObject_FFI-->>Caller: result pointer
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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_.rs`:
- Around line 5-11: The exported FFI function(s) like PyObject_GetItem (and the
other four exported functions in this module) currently have safe fn signatures
but dereference raw pointers (unsafe { &*obj }), so change their signatures to
pub unsafe extern "C" fn ... to reflect the required caller-safety contract;
update all five exported functions' declarations (keeping extern "C" and return
types) to be unsafe, and ensure any internal unsafe blocks remain as needed so
the functions properly express that callers must provide valid, non-null,
aligned pointers.
🪄 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: 29e4e1e8-0de0-495c-b69c-06e5355b891e
📒 Files selected for processing (2)
crates/capi/src/abstract_.rscrates/capi/src/lib.rs
6a28e4e to
8cc3821
Compare
8cc3821 to
4357f78
Compare
Summary by CodeRabbit