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

Method getattro

crates/vm/src/stdlib/_thread.rs:980–995  ·  view source on GitHub ↗
(zelf: &Py<Self>, attr: &Py<PyStr>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

978
979 impl GetAttr for Local {
980 fn getattro(zelf: &Py<Self>, attr: &Py<PyStr>, vm: &VirtualMachine) -> PyResult {
981 let l_dict = zelf.l_dict(vm);
982 if attr.as_bytes() == b"__dict__" {
983 Ok(l_dict.into())
984 } else {
985 zelf.as_object()
986 .generic_getattr_opt(attr, Some(l_dict), vm)?
987 .ok_or_else(|| {
988 vm.new_attribute_error(format!(
989 "{} has no attribute '{}'",
990 zelf.class().name(),
991 attr
992 ))
993 })
994 }
995 }
996 }
997
998 impl SetAttr for Local {

Callers

nothing calls this directly

Calls 6

l_dictMethod · 0.80
ok_or_elseMethod · 0.80
generic_getattr_optMethod · 0.80
SomeClass · 0.50
as_bytesMethod · 0.45
as_objectMethod · 0.45

Tested by

no test coverage detected