Add allocator functions to c-api - #8168
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 ignored due to path filters (1)
π Files selected for processing (4)
β Files skipped from review due to trivial changes (3)
π§ Files skipped from review as they are similar to previous changes (1)
π WalkthroughWalkthroughThe crate adds a new public ChangesC API pymem exports
Sequence Diagram(s)sequenceDiagram
participant CCaller
participant PymemRs
participant Libc
CCaller->>PymemRs: call PyMem_* or PyMem_Raw*
PymemRs->>Libc: malloc/calloc/realloc/free
Libc-->>PymemRs: allocation result or completion
PymemRs-->>CCaller: return pointer or void
Estimated code review effortπ― 2 (Simple) | β±οΈ ~10 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 |
bc43086 to
ea59686
Compare
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/pymem.rs`:
- Around line 4-15: Normalize zero-size inputs in the CPython memory wrappers so
they satisfy the C-API contract: update PyMem_Malloc, PyMem_Calloc, and
PyMem_Realloc to treat zero-byte requests as 1-byte allocations and ensure
realloc with a zero new_size does not free the block. Apply the same zero-size
normalization consistently to PyMem_RawMalloc, PyMem_RawCalloc, and
PyMem_RawRealloc so all memory entry points in pymem.rs behave the same way
instead of forwarding raw zero values directly to libc.
πͺ 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: a41f31dc-588b-4ce4-9d78-2a6eb0c7ed5b
β Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
π Files selected for processing (3)
crates/capi/Cargo.tomlcrates/capi/src/lib.rscrates/capi/src/pymem.rs
ea59686 to
5e7a490
Compare
Summary by CodeRabbit
New Features
Chores