Avoid infinite loop when converting objects to strings.
MODIFY
src/object.c
src/object.c
@@ -338,6 +338,7 @@ mrb_convert_type(mrb_state *mrb, mrb_value val, enum mrb_vtype type, const char
if (mrb_type(val) == type) return val;
v = convert_type(mrb, val, tname, method, TRUE);
if (mrb_type(v) != type) {
+ if (type == MRB_TT_STRING) return mrb_any_to_s(mrb, val);
mrb_raisef(mrb, E_TYPE_ERROR, "%v cannot be converted to %s by #%s", val, tname, method);
}
return v;

MODIFY
src/string.c
src/string.c
@@ -1121,6 +1121,7 @@ mrb_str_to_str(mrb_state *mrb, mrb_value str)
return mrb_sym_str(mrb, mrb_symbol(str));
case MRB_TT_FIXNUM:
return mrb_fixnum_to_str(mrb, str, 10);
+ case MRB_TT_SCLASS:
case MRB_TT_CLASS:
case MRB_TT_MODULE:
return mrb_mod_to_s(mrb, str);

Avoid infinite loop when converting objects to strings.