summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-12-10 21:24:19 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2021-01-26 16:24:01 -0800
commit646131448eea616dfb388cfea84e34358caa7b47 (patch)
tree201a94a0735f483c04d961973fdfc931ca459614 /class.c
parentd7a844cb08aaf0d073bfa2ade88e83b3df2d9676 (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3885
Diffstat (limited to 'class.c')
-rw-r--r--class.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/class.c b/class.c
index a62ae669f8..56185b4cf2 100644
--- a/class.c
+++ b/class.c
@@ -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();