Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Return exception in Py_GetConstantBorrowed
  • Loading branch information
bschoenmaeckers committed May 5, 2026
commit 71438c698f5c25303982c4a81c50bf3e3816fa51
11 changes: 8 additions & 3 deletions crates/capi/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,19 @@ pub unsafe extern "C" fn PyType_GetFlags(ptr: *const PyTypeObject) -> c_ulong {
pub extern "C" fn Py_GetConstantBorrowed(constant_id: c_uint) -> *mut PyObject {
with_vm(|vm| {
let ctx = &vm.ctx;
match constant_id {
let constant = match constant_id {
0 => ctx.none.as_object(),
1 => ctx.false_value.as_object(),
2 => ctx.true_value.as_object(),
3 => ctx.ellipsis.as_object(),
4 => ctx.not_implemented.as_object(),
_ => panic!("Invalid constant_id passed to Py_GetConstantBorrowed"),
_ => {
return Err(
vm.new_system_error("Invalid constant ID passed to Py_GetConstantBorrowed")
);
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
.as_raw()
.as_raw();
Ok(constant)
})
}
Loading