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

Method _ass_subscript

crates/vm/src/protocol/mapping.rs:151–164  ·  view source on GitHub ↗
(
        self,
        needle: &PyObject,
        value: Option<PyObjectRef>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

149 }
150
151 fn _ass_subscript(
152 self,
153 needle: &PyObject,
154 value: Option<PyObjectRef>,
155 vm: &VirtualMachine,
156 ) -> PyResult<()> {
157 let f = self.slots().ass_subscript.load().ok_or_else(|| {
158 vm.new_type_error(format!(
159 "'{}' object does not support item assignment",
160 self.obj.class()
161 ))
162 })?;
163 f(self, needle, value, vm)
164 }
165
166 pub fn keys(self, vm: &VirtualMachine) -> PyResult {
167 if let Some(dict) = self.obj.downcast_ref_if_exact::<PyDict>(vm) {

Callers 1

ass_subscriptMethod · 0.80

Calls 4

ok_or_elseMethod · 0.80
fFunction · 0.50
loadMethod · 0.45
slotsMethod · 0.45

Tested by

no test coverage detected