diff --git a/crates/stdlib/src/faulthandler.rs b/crates/stdlib/src/faulthandler.rs index cb8d47fb686..6a2a0933404 100644 --- a/crates/stdlib/src/faulthandler.rs +++ b/crates/stdlib/src/faulthandler.rs @@ -553,7 +553,7 @@ mod decl { } let mut action: libc::sigaction = core::mem::zeroed(); - action.sa_sigaction = faulthandler_fatal_error as libc::sighandler_t; + action.sa_sigaction = faulthandler_fatal_error as *const () as libc::sighandler_t; // SA_NODEFER flag action.sa_flags = libc::SA_NODEFER; @@ -583,7 +583,7 @@ mod decl { handler.previous = libc::signal( handler.signum, - faulthandler_fatal_error as libc::sighandler_t, + faulthandler_fatal_error as *const () as libc::sighandler_t, ); // SIG_ERR is -1 as sighandler_t (which is usize on Windows) @@ -937,7 +937,10 @@ mod decl { libc::signal(signum, user.previous); libc::raise(signum); // Re-register our handler - libc::signal(signum, faulthandler_user_signal as libc::sighandler_t); + libc::signal( + signum, + faulthandler_user_signal as *const () as libc::sighandler_t, + ); } } } @@ -988,7 +991,10 @@ mod decl { let previous = if !user_signals::is_enabled(signum) { // Install signal handler let prev = unsafe { - libc::signal(args.signum, faulthandler_user_signal as libc::sighandler_t) + libc::signal( + args.signum, + faulthandler_user_signal as *const () as libc::sighandler_t, + ) }; if prev == libc::SIG_ERR { return Err(vm.new_os_error(format!( diff --git a/crates/vm/src/class.rs b/crates/vm/src/class.rs index 4590b62d503..a71baf070cd 100644 --- a/crates/vm/src/class.rs +++ b/crates/vm/src/class.rs @@ -28,7 +28,7 @@ pub fn add_operators(class: &'static Py, ctx: &Context) { .slots .hash .load() - .is_some_and(|h| h as usize == hash_not_implemented as usize) + .is_some_and(|h| h as usize == hash_not_implemented as *const () as usize) { class.set_attr(ctx.names.__hash__, ctx.none.clone().into()); continue; diff --git a/crates/vm/src/stdlib/ctypes.rs b/crates/vm/src/stdlib/ctypes.rs index e219bb4f985..97255f4384f 100644 --- a/crates/vm/src/stdlib/ctypes.rs +++ b/crates/vm/src/stdlib/ctypes.rs @@ -964,13 +964,13 @@ pub(crate) mod _ctypes { #[pyattr] fn _memmove_addr(_vm: &VirtualMachine) -> usize { let f = libc::memmove; - f as usize + f as *const () as usize } #[pyattr] fn _memset_addr(_vm: &VirtualMachine) -> usize { let f = libc::memset; - f as usize + f as *const () as usize } #[pyattr] diff --git a/crates/vm/src/stdlib/signal.rs b/crates/vm/src/stdlib/signal.rs index 0426bab6c10..c265f114971 100644 --- a/crates/vm/src/stdlib/signal.rs +++ b/crates/vm/src/stdlib/signal.rs @@ -202,7 +202,7 @@ pub(crate) mod _signal { match usize::try_from_borrowed_object(vm, &handler).ok() { Some(SIG_DFL) => SIG_DFL, Some(SIG_IGN) => SIG_IGN, - None if handler.is_callable() => run_signal as sighandler_t, + None if handler.is_callable() => run_signal as *const () as sighandler_t, _ => return Err(vm.new_type_error( "signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object", )), diff --git a/crates/vm/src/vm/method.rs b/crates/vm/src/vm/method.rs index b964a974c5a..5f47c8b8c5b 100644 --- a/crates/vm/src/vm/method.rs +++ b/crates/vm/src/vm/method.rs @@ -22,7 +22,7 @@ impl PyMethod { pub fn get(obj: PyObjectRef, name: &Py, vm: &VirtualMachine) -> PyResult { let cls = obj.class(); let getattro = cls.slots.getattro.load().unwrap(); - if getattro as usize != PyBaseObject::getattro as usize { + if getattro as usize != PyBaseObject::getattro as *const () as usize { return obj.get_attr(name, vm).map(Self::Attribute); }