MCPcopy Index your code
hub / github.com/RustPython/RustPython / _ass_item

Method _ass_item

crates/vm/src/protocol/sequence.rs:240–253  ·  view source on GitHub ↗
(self, i: isize, value: Option<PyObjectRef>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

238 }
239
240 fn _ass_item(self, i: isize, value: Option<PyObjectRef>, vm: &VirtualMachine) -> PyResult<()> {
241 if let Some(f) = self.slots().ass_item.load() {
242 return f(self, i, value, vm);
243 }
244 Err(vm.new_type_error(format!(
245 "'{}' is not a sequence or doesn't support item {}",
246 self.obj.class(),
247 if value.is_some() {
248 "assignment"
249 } else {
250 "deletion"
251 }
252 )))
253 }
254
255 pub fn set_item(self, i: isize, value: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
256 self._ass_item(i, Some(value), vm)

Callers 2

set_itemMethod · 0.80
del_itemMethod · 0.80

Calls 4

fFunction · 0.50
ErrClass · 0.50
loadMethod · 0.45
slotsMethod · 0.45

Tested by

no test coverage detected