This commit is contained in:
blueloveTH 2024-01-14 14:39:20 +08:00
parent 7a386fa218
commit 6f04a519d6
2 changed files with 15 additions and 13 deletions

View File

@ -3,7 +3,7 @@ output: .retype
url: https://pocketpy.dev
branding:
title: pocketpy
label: v1.3.7
label: v1.3.8
logo: "./static/logo.png"
favicon: "./static/logo.png"
meta:

View File

@ -1032,15 +1032,16 @@ PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
PyObject* val;
if(obj->type == tp_type){
val = find_name_in_mro(obj, name);
}else{
val = obj->attr().try_get_likely_found(name);
}
if(val != nullptr){
if(is_tagged(val)) return val;
if(val->type == tp_staticmethod) return PK_OBJ_GET(StaticMethod, val).func;
if(val->type == tp_classmethod) return VAR(BoundMethod(obj, PK_OBJ_GET(ClassMethod, val).func));
return val;
}
}else{
val = obj->attr().try_get_likely_found(name);
if(val != nullptr) return val;
}
}
if(cls_var != nullptr){
// bound method is non-data descriptor
@ -1101,15 +1102,16 @@ PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject** self, b
PyObject* val;
if(obj->type == tp_type){
val = find_name_in_mro(obj, name);
}else{
val = obj->attr().try_get_likely_found(name);
}
if(val != nullptr){
if(is_tagged(val)) return val;
if(val->type == tp_staticmethod) return PK_OBJ_GET(StaticMethod, val).func;
if(val->type == tp_classmethod) return VAR(BoundMethod(obj, PK_OBJ_GET(ClassMethod, val).func));
return val;
}
}else{
val = obj->attr().try_get_likely_found(name);
if(val != nullptr) return val;
}
}
}