Add sequence protocol to the c-api#8016
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)
📝 WalkthroughWalkthroughAdds a new ChangesPySequence C API FFI Module
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 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: 2
🤖 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_/sequence.rs`:
- Around line 145-157: Add two thin no_mangle forwarders: implement an unsafe
extern "C" fn PySequence_Length that simply calls/returns PySequence_Size with
the same signature and an unsafe extern "C" fn PySequence_In that forwards to
PySequence_Contains with the same signature; annotate both with
#[unsafe(no_mangle)] and place them alongside the existing PySequence_Size and
PySequence_Contains exports so the stable-ABI symbols PySequence_Length and
PySequence_In are available.
- Around line 162-166: The function PySequence_Contains currently dereferences
caller-provided raw pointers (obj and value) but is declared as a safe extern
"C" function; change its signature to be unsafe (pub unsafe extern "C" fn
PySequence_Contains(...)) to match the other PySequence_* exports and correctly
mark that callers must uphold pointer safety, leaving the internal logic (using
&*obj, &*value and calling obj.sequence_unchecked().contains(value, vm))
unchanged.
🪄 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: abd8d7df-9cbc-4522-9ace-08ce34ca1b0e
📒 Files selected for processing (2)
crates/capi/src/abstract_.rscrates/capi/src/abstract_/sequence.rs
Summary by CodeRabbit