diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-09-19 22:22:09 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-09-20 15:23:00 +0900 |
commit | 2e3d43e5775799d1b4d6672a3a18b3fc5777c52b (patch) | |
tree | 1466984fcc6ec92eda4abad9579f045f9ad62a92 /class.c | |
parent | d2d549032c7e40d3720f298a67abbcdc5b1666a2 (diff) |
Allow to include uninitialized modules [Bug #18177]
The module that is about to be included is considered initialized.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4868
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -917,7 +917,8 @@ ensure_includable(VALUE klass, VALUE module) rb_class_modify_check(klass); Check_Type(module, T_MODULE); if (RMODULE_UNINITIALIZED(module)) { - rb_raise(rb_eArgError, "uninitialized module"); + RB_OBJ_WRITE(module, &RCLASS(module)->super, 0); + /* no more re-initialization */ } if (!NIL_P(rb_refinement_module_get_refined_class(module))) { rb_raise(rb_eArgError, "refinement module is not allowed"); |