{{ message }}
Add import support to c-api#7881
Merged
Merged
Conversation
Contributor
Contributor
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/import.rs`:
- Around line 5-8: The FFI function PyImport_Import dereferences the incoming
pointer name without a null check, causing UB; before the unsafe block that does
(&*name).try_downcast_ref::<PyStr>(vm) add a guard if name.is_null() { return
std::ptr::null_mut(); } (or set an appropriate Python error on the VM and then
return std::ptr::null_mut()) so the function returns a null pointer on invalid
input; update the PyImport_Import implementation (the with_vm closure and the
place where try_downcast_ref and vm.import are called) to early-return when name
is null rather than dereferencing it.
🪄 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: 55deddf3-1835-45db-91d4-7de4cf550570
📒 Files selected for processing (2)
crates/capi/src/import.rscrates/capi/src/lib.rs
ShaharNaveh
approved these changes
May 16, 2026
ShaharNaveh
left a comment
Contributor
There was a problem hiding this comment.
Just read the PR description...
youknowone
approved these changes
May 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add import support to the c-api. The test is currently disabled until we have enough api exposed to make it compile.
Summary by CodeRabbit