mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
68251b3640
commit
ae4057e457
8
src/vm.h
8
src/vm.h
@ -1416,12 +1416,14 @@ inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
|
|||||||
// try to load a unbound method (fallback to `getattr` if not found)
|
// try to load a unbound method (fallback to `getattr` if not found)
|
||||||
inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject** self, bool throw_err, bool fallback){
|
inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject** self, bool throw_err, bool fallback){
|
||||||
*self = PY_NULL;
|
*self = PY_NULL;
|
||||||
PyObject* objtype = _t(obj);
|
PyObject* objtype;
|
||||||
// handle super() proxy
|
// handle super() proxy
|
||||||
if(is_non_tagged_type(obj, tp_super)){
|
if(is_non_tagged_type(obj, tp_super)){
|
||||||
const Super& super = OBJ_GET(Super, obj);
|
const Super& super = OBJ_GET(Super, obj);
|
||||||
obj = super.first;
|
obj = super.first;
|
||||||
objtype = _t(super.second);
|
objtype = _t(super.second);
|
||||||
|
}else{
|
||||||
|
objtype = _t(obj);
|
||||||
}
|
}
|
||||||
PyObject* cls_var = find_name_in_mro(objtype, name);
|
PyObject* cls_var = find_name_in_mro(objtype, name);
|
||||||
|
|
||||||
@ -1451,12 +1453,14 @@ inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject**
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void VM::setattr(PyObject* obj, StrName name, PyObject* value){
|
inline void VM::setattr(PyObject* obj, StrName name, PyObject* value){
|
||||||
PyObject* objtype = _t(obj);
|
PyObject* objtype;
|
||||||
// handle super() proxy
|
// handle super() proxy
|
||||||
if(is_non_tagged_type(obj, tp_super)){
|
if(is_non_tagged_type(obj, tp_super)){
|
||||||
Super& super = OBJ_GET(Super, obj);
|
Super& super = OBJ_GET(Super, obj);
|
||||||
obj = super.first;
|
obj = super.first;
|
||||||
objtype = _t(super.second);
|
objtype = _t(super.second);
|
||||||
|
}else{
|
||||||
|
objtype = _t(obj);
|
||||||
}
|
}
|
||||||
PyObject* cls_var = find_name_in_mro(objtype, name);
|
PyObject* cls_var = find_name_in_mro(objtype, name);
|
||||||
if(cls_var != nullptr){
|
if(cls_var != nullptr){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user