This commit is contained in:
blueloveTH 2023-07-18 23:02:22 +08:00
parent 692f3c5266
commit 9a7fabeb75
2 changed files with 4 additions and 1 deletions

View File

@ -15,7 +15,7 @@ const char* pkpy_module__init__(pkpy_vm* vm, const char* version){
pkpy_setattr(vm, pkpy_name("hello")); pkpy_setattr(vm, pkpy_name("hello"));
if(pkpy_check_error(vm)){ if(pkpy_check_error(vm)){
pkpy_clear_error(vm, NULL); pkpy_clear_error(vm, NULL);
exit(1); return NULL;
} }
return "test"; return "test";
} }

View File

@ -174,6 +174,9 @@ void init_builtins(VM* _vm) {
vm->_error("ImportError", "cannot load dynamic library: " + name.escape()); vm->_error("ImportError", "cannot load dynamic library: " + name.escape());
} }
const char* name = entry(vm, PK_VERSION); const char* name = entry(vm, PK_VERSION);
if(name == nullptr){
vm->_error("ImportError", "module initialization failed: " + Str(name).escape());
}
return vm->_modules[name]; return vm->_modules[name];
} }
} }