blueloveTH 1 year ago
parent
commit
cc94a382a9
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/public/modules.c

+ 4 - 0
src/public/modules.c

@@ -437,6 +437,10 @@ static bool builtins_locals(int argc, py_Ref argv) {
 
 
 void py_newglobals(py_Ref out) {
 void py_newglobals(py_Ref out) {
     Frame* frame = pk_current_vm->top_frame;
     Frame* frame = pk_current_vm->top_frame;
+    if(!frame){
+        pk_mappingproxy__namedict(out, &pk_current_vm->main);
+        return;
+    }
     if(frame->is_dynamic) {
     if(frame->is_dynamic) {
         py_assign(out, &frame->p0[0]);
         py_assign(out, &frame->p0[0]);
     } else {
     } else {