ruby-changes:47427
From: usa <ko1@a...>
Date: Wed, 9 Aug 2017 19:14:39 +0900 (JST)
Subject: [ruby-changes:47427] usa:r59543 (ruby_2_3): merge revision(s) 59181: [Backport #13680]
usa 2017-08-09 19:14:33 +0900 (Wed, 09 Aug 2017) New Revision: 59543 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59543 Log: merge revision(s) 59181: [Backport #13680] vm_insnhelper.c: break in once * vm_insnhelper.c (vm_throw_start): size of catch table has been included in iseq_catch_table struct, which could be NULL, since 2.2. e.g., proc-closure in `once'. [ruby-core:81775] [Bug #13680] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/test/ruby/test_exception.rb branches/ruby_2_3/version.h branches/ruby_2_3/vm_insnhelper.c Index: ruby_2_3/vm_insnhelper.c =================================================================== --- ruby_2_3/vm_insnhelper.c (revision 59542) +++ ruby_2_3/vm_insnhelper.c (revision 59543) @@ -946,13 +946,13 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L946 while (escape_cfp < eocfp) { if (escape_cfp->ep == ep) { - const VALUE epc = escape_cfp->pc - escape_cfp->iseq->body->iseq_encoded; - const rb_iseq_t * const iseq = escape_cfp->iseq; - const struct iseq_catch_table * const ct = iseq->body->catch_table; - const int ct_size = ct->size; - int i; + const rb_iseq_t *const iseq = escape_cfp->iseq; + const VALUE epc = escape_cfp->pc - iseq->body->iseq_encoded; + const struct iseq_catch_table *const ct = iseq->body->catch_table; + unsigned int i; - for (i=0; i<ct_size; i++) { + if (!ct) break; + for (i=0; i < ct->size; i++) { const struct iseq_catch_table_entry * const entry = &ct->entries[i];; if (entry->type == CATCH_TYPE_BREAK && entry->start < epc && entry->end >= epc) { Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 59542) +++ ruby_2_3/ChangeLog (revision 59543) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Wed Aug 9 19:14:07 2017 Nobuyoshi Nakada <nobu@r...> + + * vm_insnhelper.c (vm_throw_start): size of catch table has been + included in iseq_catch_table struct, which could be NULL, since + 2.2. e.g., proc-closure in `once'. + Wed Aug 9 19:09:20 2017 Nobuyoshi Nakada <nobu@r...> * node.h (nd_line): should sign-extend. shifting `VALUE` extends Index: ruby_2_3/test/ruby/test_exception.rb =================================================================== --- ruby_2_3/test/ruby/test_exception.rb (revision 59542) +++ ruby_2_3/test/ruby/test_exception.rb (revision 59543) @@ -905,4 +905,15 @@ $stderr = $stdout; raise "\x82\xa0"') do https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_exception.rb#L905 } end; end + + def test_break_in_once + assert_separately([], "#{<<-"begin;"}\n#{<<~'end;'}") + begin; + obj = Object.new + def obj.try + /#{break}/o + end + assert_raise(LocalJumpError, /proc-closure/) {obj.try} + end; + end end Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 59542) +++ ruby_2_3/version.h (revision 59543) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-08-09" -#define RUBY_PATCHLEVEL 353 +#define RUBY_PATCHLEVEL 354 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 59542) +++ ruby_2_3 (revision 59543) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59181 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/