Skip to content

Commit 2c53a52

Browse files
committed
fix: Fix libc::write argument type.
The argument type for libc::write is platform dependent. The fix converts to the platform specific type using `TryInto`. This fixes Windows builds. Fixes #101.
1 parent c84f966 commit 2c53a52

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pyo3-polars/src/alloc.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ impl PolarsAllocator {
8080
if r.is_none() {
8181
// Do not use eprintln; it may alloc.
8282
let msg = b"failed to get allocator capsule\n";
83-
unsafe { libc::write(2, msg.as_ptr() as *const libc::c_void, msg.len()) };
83+
// Message length type is platform-dependent.
84+
let msg_len = msg.len().try_into().unwrap();
85+
unsafe { libc::write(2, msg.as_ptr() as *const libc::c_void, msg_len) };
8486
}
8587
r.unwrap_or(&FALLBACK_ALLOCATOR_CAPSULE)
8688
})

0 commit comments

Comments
 (0)