Merge pull request #4781 from shuujii/fix-that-Module-to_s-may-return-frozen-string

Fix that `Module#to_s` may return frozen string; ref 08eafe2
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-10-19 17:55:26 +09:00
committed by GitHub
+2 -1
View File
@@ -1885,7 +1885,8 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
return mrb_str_cat_lit(mrb, str, ">");
}
else {
return class_name_str(mrb, mrb_class_ptr(klass));
mrb_value str = class_name_str(mrb, mrb_class_ptr(klass));
return mrb_frozen_p(mrb_basic_ptr(str)) ? mrb_str_dup(mrb, str) : str;
}
}