Fix that Module#to_s may return frozen string; ref 08eafe2

This commit is contained in:
KOBAYASHI Shuji
2019-10-19 17:27:17 +09:00
parent 7957f75bd8
commit 347729a7c0
+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;
}
}