Make rb_define_module_id_under() pin existing modules

Just like rb_define_class_id_under(). Also makes
rb_define_module_under() consistent with rb_define_class_under() in the
same regard.
This commit is contained in:
Alan Wu 2020-12-10 21:24:19 -05:00 committed by Aaron Patterson
parent d7a844cb08
commit 646131448e
Notes: git 2021-01-27 09:24:34 +09:00

View File

@ -908,6 +908,8 @@ rb_define_module_id_under(VALUE outer, ID id)
" (%"PRIsVALUE")",
outer, rb_id2str(id), rb_obj_class(module));
}
/* Module may have been defined in Ruby and not pin-rooted */
rb_gc_register_mark_object(module);
return module;
}
module = rb_module_new();