This commit is contained in:
blueloveTH 2024-08-10 16:47:48 +08:00
parent f27548c6df
commit c9e688207a
2 changed files with 6 additions and 12 deletions

View File

@ -242,11 +242,11 @@ py_GlobalRef py_getreg(int i);
void py_setreg(int i, py_Ref val);
/// Get variable in the `__main__` module.
py_GlobalRef py_getglobal(const char* name);
py_GlobalRef py_getglobal(py_Name name);
/// Set variable in the `__main__` module.
void py_setglobal(const char* name, py_Ref val);
void py_setglobal(py_Name name, py_Ref val);
/// Get variable in the `builtins` module.
py_GlobalRef py_getbuiltin(const char* name);
py_GlobalRef py_getbuiltin(py_Name name);
/// Equivalent to `*dst = *src`.
void py_assign(py_Ref dst, py_Ref src);

View File

@ -13,17 +13,11 @@ py_Ref py_getmodule(const char* path) {
return NameDict__try_get(&vm->modules, py_name(path));
}
py_Ref py_getbuiltin(const char* name){
return py_getdict(&pk_current_vm->builtins, py_name(name));
}
py_Ref py_getbuiltin(py_Name name) { return py_getdict(&pk_current_vm->builtins, name); }
py_Ref py_getglobal(const char* name){
return py_getdict(&pk_current_vm->main, py_name(name));
}
py_Ref py_getglobal(py_Name name) { return py_getdict(&pk_current_vm->main, name); }
void py_setglobal(const char* name, py_Ref val){
py_setdict(&pk_current_vm->main, py_name(name), val);
}
void py_setglobal(py_Name name, py_Ref val) { py_setdict(&pk_current_vm->main, name, val); }
py_Ref py_newmodule(const char* path) {
ManagedHeap* heap = &pk_current_vm->heap;