ruby-changes:52222
From: nagachika <ko1@a...>
Date: Sat, 18 Aug 2018 11:56:37 +0900 (JST)
Subject: [ruby-changes:52222] nagachika:r64430 (ruby_2_5): merge revision(s) 63417: [Backport #14756]
nagachika 2018-08-18 11:56:32 +0900 (Sat, 18 Aug 2018) New Revision: 64430 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64430 Log: merge revision(s) 63417: [Backport #14756] error.c: check redefined backtrace result * error.c (rb_get_backtrace): check the result of `backtrace` even if the method is redefined. [ruby-core:87013] [Bug #14756] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/error.c branches/ruby_2_5/test/ruby/test_exception.rb branches/ruby_2_5/version.h Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 64429) +++ ruby_2_5/version.h (revision 64430) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.2" #define RUBY_RELEASE_DATE "2018-08-18" -#define RUBY_PATCHLEVEL 73 +#define RUBY_PATCHLEVEL 74 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_5/error.c =================================================================== --- ruby_2_5/error.c (revision 64429) +++ ruby_2_5/error.c (revision 64430) @@ -1136,19 +1136,21 @@ VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_5/error.c#L1136 rb_get_backtrace(VALUE exc) { ID mid = id_backtrace; + VALUE info; if (rb_method_basic_definition_p(CLASS_OF(exc), id_backtrace)) { - VALUE info, klass = rb_eException; + VALUE klass = rb_eException; rb_execution_context_t *ec = GET_EC(); if (NIL_P(exc)) return Qnil; EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_CALL, exc, mid, mid, klass, Qundef); info = exc_backtrace(exc); EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_RETURN, exc, mid, mid, klass, info); - if (NIL_P(info)) - return Qnil; - return rb_check_backtrace(info); } - return rb_funcallv(exc, mid, 0, 0); + else { + info = rb_funcallv(exc, mid, 0, 0); + } + if (NIL_P(info)) return Qnil; + return rb_check_backtrace(info); } /* Index: ruby_2_5/test/ruby/test_exception.rb =================================================================== --- ruby_2_5/test/ruby/test_exception.rb (revision 64429) +++ ruby_2_5/test/ruby/test_exception.rb (revision 64430) @@ -1123,6 +1123,16 @@ $stderr = $stdout; raise "\x82\xa0"') do https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_exception.rb#L1123 raise RuntimeError, "hello" } end; + + error_class = Class.new(StandardError) do + def backtrace; :backtrace; end + end + begin + raise error_class + rescue error_class => e + assert_raise(TypeError) {$@} + assert_raise(TypeError) {e.full_message} + end end def test_full_message Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 64429) +++ ruby_2_5 (revision 64430) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r63417 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/