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

Method __set_name__

crates/vm/src/builtins/property.rs:174–186  ·  view source on GitHub ↗
(&self, args: PosArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

172
173 #[pymethod]
174 fn __set_name__(&self, args: PosArgs, vm: &VirtualMachine) -> PyResult<()> {
175 let func_args = args.into_args(vm);
176 let func_args_len = func_args.args.len();
177 let (_owner, name): (PyObjectRef, PyObjectRef) = func_args.bind(vm).map_err(|_e| {
178 vm.new_type_error(format!(
179 "__set_name__() takes 2 positional arguments but {func_args_len} were given"
180 ))
181 })?;
182
183 *self.name.write() = Some(name);
184
185 Ok(())
186 }
187
188 // Python builder functions
189

Callers

nothing calls this directly

Calls 5

SomeClass · 0.50
into_argsMethod · 0.45
lenMethod · 0.45
bindMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected