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
retype slot zelf
  • Loading branch information
youknowone committed Dec 15, 2025
commit 6adebaf614bf168d9788186351143d0e062e470b
22 changes: 8 additions & 14 deletions crates/vm/src/types/slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,9 @@ where
pub trait Initializer: PyPayload {
type Args: FromArgs;

#[pyslot]
#[inline]
#[pyslot]
#[pymethod(name = "__init__")]
fn slot_init(zelf: PyObjectRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
#[cfg(debug_assertions)]
let class_name_for_debug = zelf.class().name().to_string();
Expand Down Expand Up @@ -979,13 +980,6 @@ pub trait Initializer: PyPayload {
Self::init(zelf, args, vm)
}

#[pymethod]
#[inline]
fn __init__(zelf: PyRef<Self>, args: Self::Args, vm: &VirtualMachine) -> PyResult<()> {
// TODO: check if this is safe. zelf may need to be `PyObjectRef`
Self::init(zelf, args, vm)
}

fn init(zelf: PyRef<Self>, args: Self::Args, vm: &VirtualMachine) -> PyResult<()>;
}

Expand Down Expand Up @@ -1340,8 +1334,8 @@ pub trait GetAttr: PyPayload {

#[inline]
#[pymethod]
fn __getattribute__(zelf: PyRef<Self>, name: PyStrRef, vm: &VirtualMachine) -> PyResult {
Self::getattro(&zelf, &name, vm)
fn __getattribute__(zelf: PyObjectRef, name: PyStrRef, vm: &VirtualMachine) -> PyResult {
Self::slot_getattro(&zelf, &name, vm)
}
}

Expand Down Expand Up @@ -1371,18 +1365,18 @@ pub trait SetAttr: PyPayload {
#[inline]
#[pymethod]
fn __setattr__(
zelf: PyRef<Self>,
zelf: PyObjectRef,
name: PyStrRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<()> {
Self::setattro(&zelf, &name, PySetterValue::Assign(value), vm)
Self::slot_setattro(&zelf, &name, PySetterValue::Assign(value), vm)
}

#[inline]
#[pymethod]
fn __delattr__(zelf: PyRef<Self>, name: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
Self::setattro(&zelf, &name, PySetterValue::Delete, vm)
fn __delattr__(zelf: PyObjectRef, name: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
Self::slot_setattro(&zelf, &name, PySetterValue::Delete, vm)
}
}

Expand Down
Loading