This commit is contained in:
blueloveTH 2024-05-04 13:59:59 +08:00
parent 473e78f6c3
commit 83ca79e5f7

View File

@ -351,12 +351,15 @@ public:
mod->attr().set(name, type);
_cxx_typeid_map[typeid(T)] = PK_OBJ_GET(Type, type);
T::_register(vm, mod, type);
// check if T is trivially constructible
if constexpr(!std::is_default_constructible_v<T>){
if(!type->attr().contains(__new__)){
bind_func(type, __new__, -1, [](VM* vm, ArgsView args){
vm->NotImplementedError();
return vm->None;
});
}
}
return type;
}