summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2022-01-30 19:08:49 +0900
committerNARUSE, Yui <naruse@airemix.jp>2022-01-30 19:08:49 +0900
commit28ec24db4a8201fa624692cdc1cbef9b00489412 (patch)
tree0a9b473c0e202f54358bd666fa6be523cfacc3e5 /class.c
parent1a1737530bff683041b8f45e7acac8c5c85c4163 (diff)
merge revision(s) a79c59472df38297c246b27713c277f2edaefa7a: [Backport #18292]
Allow include before calling Module#initialize This is to allow Module subclasses that include modules before calling super in the subclass's initialize. Remove rb_module_check_initializable from Module#initialize. Module#initialize only calls module_exec if a block is passed, it doesn't have other issues that would cause problems if called multiple times or with an already initialized module. Move initialization of super to Module#allocate, though I'm not sure it is required there. However, it's needed to be removed from Module#initialize for this to work. Fixes [Bug #18292] --- class.c | 1 + object.c | 1 - test/ruby/test_module.rb | 10 ++++++++++ 3 files changed, 11 insertions(+), 1 deletion(-)
Diffstat (limited to 'class.c')
-rw-r--r--class.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/class.c b/class.c
index f83a16a08e..5d3d46d1e6 100644
--- a/class.c
+++ b/class.c
@@ -913,6 +913,7 @@ rb_module_s_alloc(VALUE klass)
VALUE mod = class_alloc(T_MODULE, klass);
RCLASS_M_TBL_INIT(mod);
FL_SET(mod, RMODULE_ALLOCATED_BUT_NOT_INITIALIZED);
+ RB_OBJ_WRITE(mod, &RCLASS(mod)->super, 0);
return mod;
}