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
Next Next commit
slots: remove duplicate pymethods from object
  • Loading branch information
youknowone committed Dec 31, 2025
commit 7519cf9696b510234f5cb25df8025e8254118870
72 changes: 0 additions & 72 deletions crates/vm/src/builtins/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,66 +326,6 @@ impl PyBaseObject {
Ok(res)
}

/// Return self==value.
#[pymethod]
fn __eq__(
zelf: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &value, PyComparisonOp::Eq, vm)
}

/// Return self!=value.
#[pymethod]
fn __ne__(
zelf: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &value, PyComparisonOp::Ne, vm)
}

/// Return self<value.
#[pymethod]
fn __lt__(
zelf: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &value, PyComparisonOp::Lt, vm)
}

/// Return self<=value.
#[pymethod]
fn __le__(
zelf: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &value, PyComparisonOp::Le, vm)
}

/// Return self>=value.
#[pymethod]
fn __ge__(
zelf: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &value, PyComparisonOp::Ge, vm)
}

/// Return self>value.
#[pymethod]
fn __gt__(
zelf: PyObjectRef,
value: PyObjectRef,
vm: &VirtualMachine,
) -> PyResult<PyComparisonValue> {
Self::cmp(&zelf, &value, PyComparisonOp::Gt, vm)
}

/// Implement setattr(self, name, value).
#[pymethod]
fn __setattr__(
Expand Down Expand Up @@ -450,12 +390,6 @@ impl PyBaseObject {
}
}

/// Return repr(self).
#[pymethod]
fn __repr__(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyStrRef> {
Self::slot_repr(&zelf, vm)
}

#[pyclassmethod]
fn __subclasshook__(_args: FuncArgs, vm: &VirtualMachine) -> PyObjectRef {
vm.ctx.not_implemented()
Expand Down Expand Up @@ -590,12 +524,6 @@ impl PyBaseObject {
Ok(zelf.get_id() as _)
}

/// Return hash(self).
#[pymethod]
fn __hash__(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyHash> {
Self::slot_hash(&zelf, vm)
}

#[pymethod]
fn __sizeof__(zelf: PyObjectRef) -> usize {
zelf.class().slots.basicsize
Expand Down