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 <sinjihng@gmail.com>
This commit is contained in:
snowapril
2021-10-12 23:52:10 +09:00
parent 1bff6a38d1
commit 46347aa6d4

View File

@@ -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;