Skip to content

Commit

Permalink
fix: Fix libc::write argument type. (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetuk authored Sep 12, 2024
1 parent 60c487f commit 632776a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyo3-polars/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ impl PolarsAllocator {
if r.is_none() {
// Do not use eprintln; it may alloc.
let msg = b"failed to get allocator capsule\n";
unsafe { libc::write(2, msg.as_ptr() as *const libc::c_void, msg.len()) };
// Message length type is platform-dependent.
let msg_len = msg.len().try_into().unwrap();
unsafe { libc::write(2, msg.as_ptr() as *const libc::c_void, msg_len) };
}
r.unwrap_or(&FALLBACK_ALLOCATOR_CAPSULE)
})
Expand Down

0 comments on commit 632776a

Please sign in to comment.