mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
...
This commit is contained in:
parent
ab3605a661
commit
c398abb1cb
10
src/vm.h
10
src/vm.h
@ -939,7 +939,7 @@ inline PyObject* VM::_py_call(PyObject** p0, PyObject* callable, ArgsView args,
|
|||||||
inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
|
inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
|
||||||
PyObject* objtype = _t(obj);
|
PyObject* objtype = _t(obj);
|
||||||
// handle super() proxy
|
// handle super() proxy
|
||||||
if(is_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);
|
||||||
@ -957,7 +957,7 @@ inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
|
|||||||
}
|
}
|
||||||
if(cls_var != nullptr){
|
if(cls_var != nullptr){
|
||||||
// bound method is non-data descriptor
|
// bound method is non-data descriptor
|
||||||
if(is_type(cls_var, tp_function) || is_type(cls_var, tp_native_func)){
|
if(is_non_tagged_type(cls_var, tp_function) || is_non_tagged_type(cls_var, tp_native_func)){
|
||||||
return VAR(BoundMethod(obj, cls_var));
|
return VAR(BoundMethod(obj, cls_var));
|
||||||
}
|
}
|
||||||
return cls_var;
|
return cls_var;
|
||||||
@ -972,7 +972,7 @@ inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject**
|
|||||||
*self = _py_null;
|
*self = _py_null;
|
||||||
PyObject* objtype = _t(obj);
|
PyObject* objtype = _t(obj);
|
||||||
// handle super() proxy
|
// handle super() proxy
|
||||||
if(is_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);
|
||||||
@ -993,7 +993,7 @@ inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject**
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(cls_var != nullptr){
|
if(cls_var != nullptr){
|
||||||
if(is_type(cls_var, tp_function) || is_type(cls_var, tp_native_func)){
|
if(is_non_tagged_type(cls_var, tp_function) || is_non_tagged_type(cls_var, tp_native_func)){
|
||||||
*self = obj;
|
*self = obj;
|
||||||
}
|
}
|
||||||
return cls_var;
|
return cls_var;
|
||||||
@ -1005,7 +1005,7 @@ 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 = _t(obj);
|
||||||
// handle super() proxy
|
// handle super() proxy
|
||||||
if(is_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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user