From 46347aa6d46c6cb6312f42dea2bfdcf46f76cbae Mon Sep 17 00:00:00 2001 From: snowapril Date: Tue, 12 Oct 2021 23:52:10 +0900 Subject: [PATCH] fix `PyMethod::get` to use `vm.get_attribute` As cpython implementation, if `getattro` slot is not `PyBaseObject::getattro`, then use `vm.get_attribute` not slot method. Signed-off-by: snowapril --- vm/src/pyobject.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index d6dcf08806..d70c1041fa 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -1047,7 +1047,7 @@ impl PyMethod { let getattro = cls.mro_find_map(|cls| cls.slots.getattro.load()).unwrap(); if getattro as usize != object::PyBaseObject::getattro as usize { drop(cls); - return getattro(obj, name, vm).map(Self::Attribute); + return obj.get_attr(name, vm).map(Self::Attribute); } let mut is_method = false;