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

Method set_attr

crates/vm/src/protocol/object.rs:171–180  ·  view source on GitHub ↗
(
        &self,
        attr_name: impl AsPyStr<'a>,
        attr_value: impl Into<PyObjectRef>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

169 }
170
171 pub fn set_attr<'a>(
172 &self,
173 attr_name: impl AsPyStr<'a>,
174 attr_value: impl Into<PyObjectRef>,
175 vm: &VirtualMachine,
176 ) -> PyResult<()> {
177 let attr_name = attr_name.as_pystr(&vm.ctx);
178 let attr_value = attr_value.into();
179 self.call_set_attr(vm, attr_name, PySetterValue::Assign(attr_value))
180 }
181
182 // int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value)
183 #[cfg_attr(feature = "flame-it", flame)]

Callers

nothing calls this directly

Calls 2

as_pystrMethod · 0.80
call_set_attrMethod · 0.80

Tested by

no test coverage detected