add new function mrb_toplevel_run to prevent running through C function boudaries on exceptions; close #1942

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-03-26 01:09:09 +09:00
parent b042b951ce
commit bfd2a539ed
4 changed files with 21 additions and 3 deletions
+2 -2
View File
@@ -512,7 +512,7 @@ mrb_load_irep_cxt(mrb_state *mrb, const uint8_t *bin, mrbc_context *c)
proc = mrb_proc_new(mrb, irep);
mrb_irep_decref(mrb, irep);
if (c && c->no_exec) return mrb_obj_value(proc);
val = mrb_context_run(mrb, proc, mrb_top_self(mrb), 0);
val = mrb_toplevel_run(mrb, proc);
return val;
}
@@ -733,7 +733,7 @@ mrb_load_irep_file_cxt(mrb_state *mrb, FILE* fp, mrbc_context *c)
proc = mrb_proc_new(mrb, irep);
mrb_irep_decref(mrb, irep);
if (c && c->no_exec) return mrb_obj_value(proc);
val = mrb_context_run(mrb, proc, mrb_top_self(mrb), 0);
val = mrb_toplevel_run(mrb, proc);
return val;
}