mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
fix a bug of type.__class__
This commit is contained in:
parent
01fecaa352
commit
c3f10ae4d1
@ -1658,7 +1658,7 @@ void add_module_gc(VM* vm){
|
|||||||
void VM::post_init(){
|
void VM::post_init(){
|
||||||
init_builtins(this);
|
init_builtins(this);
|
||||||
|
|
||||||
bind_property(_t(tp_object), "__class__", PK_LAMBDA(VAR(vm->_t(args[0]))));
|
bind_property(_t(tp_object), "__class__", PK_LAMBDA(vm->_t(args[0])));
|
||||||
bind_property(_t(tp_type), "__base__", [](VM* vm, ArgsView args){
|
bind_property(_t(tp_type), "__base__", [](VM* vm, ArgsView args){
|
||||||
const PyTypeInfo& info = vm->_all_types[PK_OBJ_GET(Type, args[0])];
|
const PyTypeInfo& info = vm->_all_types[PK_OBJ_GET(Type, args[0])];
|
||||||
return info.base.index == -1 ? vm->None : vm->_all_types[info.base].obj;
|
return info.base.index == -1 ? vm->None : vm->_all_types[info.base].obj;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user