Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/vm/src/protocol/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ impl PyObject {
dict: Option<PyDictRef>,
vm: &VirtualMachine,
) -> PyResult<Option<PyObjectRef>> {
let name = name_str.as_wtf8();
let obj_cls = self.class();
let cls_attr_name = vm.ctx.interned_str(name_str);
let cls_attr = match cls_attr_name.and_then(|name| obj_cls.get_attr(name)) {
Expand All @@ -251,7 +250,9 @@ impl PyObject {
let dict = dict.or_else(|| self.dict());

let attr = if let Some(dict) = dict {
dict.get_item_opt(name, vm)?
// Look up by the `PyStr` object (cached hash + pointer-equality fast
// path) rather than its `&Wtf8` content, which re-hashes every call.
dict.get_item_opt(name_str, vm)?
} else {
None
};
Expand Down
Loading