Add sequence protocol to the c-api by bschoenmaeckers · Pull Request #8016 · RustPython/RustPython
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: d8f99341-f787-4404-890e-ad2b5d20b563
📒 Files selected for processing (1)
crates/capi/src/abstract_/sequence.rs
📝 Walkthrough
Walkthrough
Adds a new sequence module to the C API abstract layer and implements exported PySequence_* FFI wrappers that forward sequence operations into the VM; includes a disabled pyo3 test module.
Changes
PySequence C API FFI Module
| Layer / File(s) | Summary |
|---|---|
Module declaration and public re-export crates/capi/src/abstract_.rs |
The sequence module is declared and re-exported via pub use sequence::* so its public items are available from the abstract layer. |
PySequence_ FFI implementations* crates/capi/src/abstract_/sequence.rs |
Implements exported #[no_mangle] extern "C" wrappers for sequence protocol operations (Check, Size, GetItem/SetItem/DelItem, GetSlice/SetSlice/DelSlice, Concat/InPlaceConcat, Repeat/InPlaceRepeat, Count, Index, List, Tuple, Contains, and membership wrapper). Each wrapper calls with_vm, dereferences PyObject* inputs, and delegates to sequence APIs. |
Disabled pyo3 test module crates/capi/src/abstract_/sequence.rs |
A #[cfg(false)] test module (pyo3) exercises item/slice ops, concat/repeat/in-place behaviors, count/index/contains, and dict membership; it is disabled at compile time. |
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers
- youknowone
- ShaharNaveh
Poem
🐰 I hopped through code with nimble paws,
I bound the sequences to C's applause,
Sixteen calls now answer the VM's beat,
Lists and tuples all lined up neat,
RustPython sings — a rabbit's treat!
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Add sequence protocol to the c-api' directly and clearly describes the main change: adding sequence protocol support to the C API. It accurately summarizes the changeset which adds a new sequence module with multiple FFI functions. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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 @coderabbitai help to get the list of available commands and usage tips.