variable.c: skip const_added hook during bootstrapping; fix #6613

dd96afd added const_added hook call to mrb_const_set(), but calling
mrb_funcall_argv() during core initialization (before bootstrapping
completes) fails on bare metal platforms where VM is not fully ready.
skip hook during mrb->bootstrapping phase, matching pattern used in
class.c for method cache clearing.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-11-13 16:46:50 +09:00
parent 153f915d5f
commit 92640097ab
+4 -2
View File
@@ -1065,8 +1065,10 @@ mrb_const_set(mrb_state *mrb, mrb_value mod, mrb_sym sym, mrb_value v)
}
mrb_obj_iv_set(mrb, mrb_obj_ptr(mod), sym, v);
mrb_value name = mrb_symbol_value(sym);
mrb_funcall_argv(mrb, mod, MRB_SYM(const_added), 1, &name);
if (!mrb->bootstrapping) {
mrb_value name = mrb_symbol_value(sym);
mrb_funcall_argv(mrb, mod, MRB_SYM(const_added), 1, &name);
}
}
/*