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

Function delattr

crates/vm/src/stdlib/builtins.rs:446–454  ·  view source on GitHub ↗
(obj: PyObjectRef, attr: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

444
445 #[pyfunction]
446 fn delattr(obj: PyObjectRef, attr: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
447 let attr = attr.try_to_ref::<PyStr>(vm).map_err(|_e| {
448 vm.new_type_error(format!(
449 "attribute name must be string, not '{}'",
450 attr.class().name()
451 ))
452 })?;
453 obj.del_attr(attr, vm)
454 }
455
456 #[pyfunction]
457 fn dir(obj: OptionalArg<PyObjectRef>, vm: &VirtualMachine) -> PyResult<PyList> {

Callers 15

generic_visitMethod · 0.85
__set_name__Method · 0.85
__new__Method · 0.85
_parse_known_args2Method · 0.85
_process_classFunction · 0.85
__delitem__Method · 0.85
__delattr__Method · 0.85
__exit__Method · 0.85
_mock_set_magicsMethod · 0.85
test_shlex.pyFile · 0.85
cantMethod · 0.85

Calls 1

del_attrMethod · 0.80

Tested by 8

cantMethod · 0.68
cannot_set_attrMethod · 0.68
test_delattrMethod · 0.68
mock_socket_moduleFunction · 0.68
__delattr__Function · 0.68