fix a bug of type.__class__

This commit is contained in:
blueloveTH 2023-10-15 04:31:16 +08:00
parent 01fecaa352
commit c3f10ae4d1

View File

@ -1658,7 +1658,7 @@ void add_module_gc(VM* vm){
void VM::post_init(){
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){
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;