Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 10 additions & 4 deletions crates/stdlib/src/faulthandler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
);
}
}
}
Expand Down Expand Up @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn add_operators(class: &'static Py<PyType>, 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;
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/stdlib/ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)),
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/vm/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl PyMethod {
pub fn get(obj: PyObjectRef, name: &Py<PyStr>, vm: &VirtualMachine) -> PyResult<Self> {
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);
}

Expand Down
Loading