Skip to content
Merged
Show file tree
Hide file tree
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
__getitem__ without pymethod
  • Loading branch information
youknowone committed Jan 1, 2026
commit 96bd1d8f701347bbce0b8c27ff558e278b9bf34c
1 change: 0 additions & 1 deletion crates/stdlib/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,6 @@ mod array {
}
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self.getitem_inner(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/stdlib/src/contextvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ mod _contextvars {
}
}

#[pymethod]
fn __getitem__(
&self,
var: PyRef<ContextVar>,
Expand Down
1 change: 0 additions & 1 deletion crates/stdlib/src/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,6 @@ mod mmap {
Ok(())
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
self.getitem_inner(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/bytearray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ impl PyByteArray {
Ok(zelf)
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self._getitem(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ impl PyBytes {
PyBytesInner::maketrans(from, to, vm)
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self._getitem(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ impl Py<PyDict> {
Ok(Implemented(true))
}

#[pymethod]
#[cfg_attr(feature = "flame-it", flame("PyDictRef"))]
fn __getitem__(&self, key: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self.inner_getitem(&*key, vm)
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/genericalias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ impl PyGenericAlias {
}
}

#[pymethod]
fn __getitem__(zelf: PyRef<Self>, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
let new_args = subs_parameters(
zelf.to_owned().into(),
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ impl PyList {
}
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self._getitem(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/mappingproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ impl PyMappingProxy {
)?))
}

#[pymethod]
pub fn __getitem__(&self, key: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self.get_inner(key.clone(), vm)?
.ok_or_else(|| vm.new_key_error(key))
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,6 @@ impl PyMemoryView {
self.release();
}

#[pymethod]
fn __getitem__(zelf: PyRef<Self>, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
zelf.try_not_released(vm)?;
if zelf.desc.ndim() == 0 {
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ impl PyRange {
(vm.ctx.types.range_type.to_owned(), range_parameters_tuple)
}

#[pymethod]
fn __getitem__(&self, subscript: PyObjectRef, vm: &VirtualMachine) -> PyResult {
match RangeIndex::try_from_object(vm, subscript)? {
RangeIndex::Slice(slice) => {
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ impl PyStr {
Ok(item)
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self._getitem(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ impl PyTuple {
}
}

#[pymethod]
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
self._getitem(&needle, vm)
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/stdlib/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ mod _collections {
self.maxlen
}

#[pymethod]
fn __getitem__(&self, idx: isize, vm: &VirtualMachine) -> PyResult {
let deque = self.borrow_deque();
idx.wrapped_at(deque.len())
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/stdlib/ctypes/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ impl PyCArray {
}

// Array_subscript
#[pymethod]
fn __getitem__(zelf: &Py<Self>, item: PyObjectRef, vm: &VirtualMachine) -> PyResult {
// PyIndex_Check
if let Some(i) = item.downcast_ref::<PyInt>() {
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/stdlib/ctypes/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ impl PyCPointer {
}

// Pointer_subscript
#[pymethod]
fn __getitem__(zelf: &Py<Self>, item: PyObjectRef, vm: &VirtualMachine) -> PyResult {
// PyIndex_Check
if let Some(i) = item.downcast_ref::<PyInt>() {
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/stdlib/sre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,6 @@ mod _sre {
})
}

#[pymethod]
fn __getitem__(
&self,
group: PyObjectRef,
Expand Down