Skip to content

Commit b31b812

Browse files
committed
Define only wrapper_descriptor
1 parent 9ddd07a commit b31b812

2 files changed

Lines changed: 2 additions & 108 deletions

File tree

crates/vm/src/types/slot.rs

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ use crate::common::lock::{
33
};
44
use crate::{
55
AsObject, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
6-
builtins::{PyInt, PyStr, PyStrInterned, PyStrRef, PyType, PyTypeRef},
6+
builtins::{PyInt, PyStr, PyStrInterned, PyType, PyTypeRef},
77
bytecode::ComparisonOperator,
88
common::hash::{PyHash, fix_sentinel, hash_bigint},
99
convert::ToPyObject,
10-
function::{
11-
Either, FromArgs, FuncArgs, OptionalArg, PyComparisonValue, PyMethodDef, PySetterValue,
12-
},
10+
function::{Either, FromArgs, FuncArgs, PyComparisonValue, PyMethodDef, PySetterValue},
1311
protocol::{
1412
PyBuffer, PyIterReturn, PyMapping, PyMappingMethods, PyMappingSlots, PyNumber,
1513
PyNumberMethods, PyNumberSlots, PySequence, PySequenceMethods, PySequenceSlots,
@@ -1681,11 +1679,6 @@ pub trait Destructor: PyPayload {
16811679
Self::del(zelf, vm)
16821680
}
16831681

1684-
#[pymethod]
1685-
fn __del__(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
1686-
Self::slot_del(&zelf, vm)
1687-
}
1688-
16891682
fn del(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<()>;
16901683
}
16911684

@@ -1711,11 +1704,6 @@ pub trait Callable: PyPayload {
17111704
Self::call(zelf, args, vm)
17121705
}
17131706

1714-
#[inline]
1715-
#[pymethod]
1716-
fn __call__(zelf: PyObjectRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
1717-
Self::slot_call(&zelf, args.bind(vm)?, vm)
1718-
}
17191707
fn call(zelf: &Py<Self>, args: Self::Args, vm: &VirtualMachine) -> PyResult;
17201708
}
17211709

@@ -1729,17 +1717,6 @@ pub trait GetDescriptor: PyPayload {
17291717
vm: &VirtualMachine,
17301718
) -> PyResult;
17311719

1732-
#[inline]
1733-
#[pymethod]
1734-
fn __get__(
1735-
zelf: PyObjectRef,
1736-
obj: PyObjectRef,
1737-
cls: OptionalArg<PyObjectRef>,
1738-
vm: &VirtualMachine,
1739-
) -> PyResult {
1740-
Self::descr_get(zelf, Some(obj), cls.into_option(), vm)
1741-
}
1742-
17431720
#[inline]
17441721
fn _as_pyref<'a>(zelf: &'a PyObject, vm: &VirtualMachine) -> PyResult<&'a Py<Self>> {
17451722
zelf.try_to_value(vm)
@@ -1847,61 +1824,6 @@ pub trait Comparable: PyPayload {
18471824
op: PyComparisonOp,
18481825
vm: &VirtualMachine,
18491826
) -> PyResult<PyComparisonValue>;
1850-
1851-
#[inline]
1852-
#[pymethod]
1853-
fn __eq__(
1854-
zelf: &Py<Self>,
1855-
other: PyObjectRef,
1856-
vm: &VirtualMachine,
1857-
) -> PyResult<PyComparisonValue> {
1858-
Self::cmp(zelf, &other, PyComparisonOp::Eq, vm)
1859-
}
1860-
#[inline]
1861-
#[pymethod]
1862-
fn __ne__(
1863-
zelf: &Py<Self>,
1864-
other: PyObjectRef,
1865-
vm: &VirtualMachine,
1866-
) -> PyResult<PyComparisonValue> {
1867-
Self::cmp(zelf, &other, PyComparisonOp::Ne, vm)
1868-
}
1869-
#[inline]
1870-
#[pymethod]
1871-
fn __lt__(
1872-
zelf: &Py<Self>,
1873-
other: PyObjectRef,
1874-
vm: &VirtualMachine,
1875-
) -> PyResult<PyComparisonValue> {
1876-
Self::cmp(zelf, &other, PyComparisonOp::Lt, vm)
1877-
}
1878-
#[inline]
1879-
#[pymethod]
1880-
fn __le__(
1881-
zelf: &Py<Self>,
1882-
other: PyObjectRef,
1883-
vm: &VirtualMachine,
1884-
) -> PyResult<PyComparisonValue> {
1885-
Self::cmp(zelf, &other, PyComparisonOp::Le, vm)
1886-
}
1887-
#[inline]
1888-
#[pymethod]
1889-
fn __ge__(
1890-
zelf: &Py<Self>,
1891-
other: PyObjectRef,
1892-
vm: &VirtualMachine,
1893-
) -> PyResult<PyComparisonValue> {
1894-
Self::cmp(zelf, &other, PyComparisonOp::Ge, vm)
1895-
}
1896-
#[inline]
1897-
#[pymethod]
1898-
fn __gt__(
1899-
zelf: &Py<Self>,
1900-
other: PyObjectRef,
1901-
vm: &VirtualMachine,
1902-
) -> PyResult<PyComparisonValue> {
1903-
Self::cmp(zelf, &other, PyComparisonOp::Gt, vm)
1904-
}
19051827
}
19061828

19071829
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
@@ -2013,12 +1935,6 @@ pub trait GetAttr: PyPayload {
20131935
}
20141936

20151937
fn getattro(zelf: &Py<Self>, name: &Py<PyStr>, vm: &VirtualMachine) -> PyResult;
2016-
2017-
#[inline]
2018-
#[pymethod]
2019-
fn __getattribute__(zelf: PyObjectRef, name: PyStrRef, vm: &VirtualMachine) -> PyResult {
2020-
Self::slot_getattro(&zelf, &name, vm)
2021-
}
20221938
}
20231939

20241940
#[pyclass]
@@ -2043,23 +1959,6 @@ pub trait SetAttr: PyPayload {
20431959
value: PySetterValue,
20441960
vm: &VirtualMachine,
20451961
) -> PyResult<()>;
2046-
2047-
#[inline]
2048-
#[pymethod]
2049-
fn __setattr__(
2050-
zelf: PyObjectRef,
2051-
name: PyStrRef,
2052-
value: PyObjectRef,
2053-
vm: &VirtualMachine,
2054-
) -> PyResult<()> {
2055-
Self::slot_setattro(&zelf, &name, PySetterValue::Assign(value), vm)
2056-
}
2057-
2058-
#[inline]
2059-
#[pymethod]
2060-
fn __delattr__(zelf: PyObjectRef, name: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
2061-
Self::slot_setattro(&zelf, &name, PySetterValue::Delete, vm)
2062-
}
20631962
}
20641963

20651964
#[pyclass]

crates/vm/src/types/structseq.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,6 @@ pub trait PyStructSequence: StaticType + PyClassImpl + Sized + 'static {
243243
Ok(vm.ctx.new_str(repr_str))
244244
}
245245

246-
#[pymethod]
247-
fn __repr__(zelf: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyStrRef> {
248-
Self::slot_repr(&zelf, vm)
249-
}
250-
251246
#[pymethod]
252247
fn __replace__(zelf: PyRef<PyTuple>, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
253248
if !args.args.is_empty() {

0 commit comments

Comments
 (0)