Project

General

Profile

Bug #14566 ยป fix-bug-14566.patch

ujihisa (Tatsuhiro Ujihisa), 04/10/2018 12:55 PM

View differences:

eval_error.c
}
}
VALUE rb_call_message(VALUE recv)
{
return rb_funcall(recv, rb_intern("message"), 0);
}
void
rb_error_write(VALUE errinfo, VALUE errat, VALUE str, VALUE highlight, VALUE reverse)
{
......
errat = Qnil;
}
if ((eclass = CLASS_OF(errinfo)) != Qundef) {
VALUE e = rb_check_funcall(errinfo, rb_intern("message"), 0, 0);
if (e != Qundef) {
if (!RB_TYPE_P(e, T_STRING)) e = rb_check_string_type(e);
emesg = e;
}
int state = 0;
VALUE e = rb_protect(rb_call_message, errinfo, &state);
if (state) rb_warning("Exception caught automatically in \"message\" method");
if (!RB_TYPE_P(e, T_STRING)) e = rb_check_string_type(e);
emesg = e;
}
if (NIL_P(reverse) || NIL_P(highlight)) {
VALUE tty = (VALUE)rb_stderr_tty_p();
test/ruby/test_exception.rb
assert_operator(message, :end_with?, top)
end
end
# def test_message_with_exception_wont_cause_infinite_loop
# bug14566 = '[Bug #14566]'
# assert_nothing_raised(Exception, bug14566) do
# eclass = Class.new(StandardError) do
# def message
# raise
# end
# end
# begin
# raise eclass
# rescue => e
# e.message
# end
# end
# end
end
    (1-1/1)