From aa2b32ae4bac4e1fcfc5986977d9111b32d0458e Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 11 Apr 2018 08:03:43 +0000 Subject: eval_error.c: fix loop on exception in message * error.c (rb_get_message): accessor to the message. * eval_error.c (rb_ec_error_print): handle exceptions on fetching the message. [Bug #14566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 61521cbfff..43115de3bd 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1309,4 +1309,15 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| assert_operator(message, :end_with?, top) end end + + def test_exception_in_message + code = "#{<<~"begin;"}\n#{<<~'end;'}" + begin; + class Bug14566 < StandardError + def message; raise self.class; end + end + raise Bug14566 + end; + assert_in_out_err([], code, [], /Bug14566/, success: false, timeout: 1) + end end -- cgit v1.2.3