[前][次][番号順一覧][スレッド一覧]

ruby-changes:47375

From: nagachika <ko1@a...>
Date: Fri, 4 Aug 2017 00:40:16 +0900 (JST)
Subject: [ruby-changes:47375] nagachika:r59491 (ruby_2_4): merge revision(s) 59181: [Backport #13680]

nagachika	2017-08-04 00:40:10 +0900 (Fri, 04 Aug 2017)

  New Revision: 59491

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59491

  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_4/
  Modified files:
    branches/ruby_2_4/test/ruby/test_exception.rb
    branches/ruby_2_4/version.h
    branches/ruby_2_4/vm_insnhelper.c
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 59490)
+++ ruby_2_4/version.h	(revision 59491)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.2"
-#define RUBY_RELEASE_DATE "2017-08-03"
-#define RUBY_PATCHLEVEL 164
+#define RUBY_RELEASE_DATE "2017-08-04"
+#define RUBY_PATCHLEVEL 165
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 3
+#define RUBY_RELEASE_DAY 4
 
 #include "ruby/version.h"
 
Index: ruby_2_4/vm_insnhelper.c
===================================================================
--- ruby_2_4/vm_insnhelper.c	(revision 59490)
+++ ruby_2_4/vm_insnhelper.c	(revision 59491)
@@ -1039,13 +1039,13 @@ vm_throw_start(rb_thread_t *const th, rb https://github.com/ruby/ruby/blob/trunk/ruby_2_4/vm_insnhelper.c#L1039
 
 	    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_4/test/ruby/test_exception.rb
===================================================================
--- ruby_2_4/test/ruby/test_exception.rb	(revision 59490)
+++ ruby_2_4/test/ruby/test_exception.rb	(revision 59491)
@@ -1019,4 +1019,15 @@ $stderr = $stdout; raise "\x82\xa0"') do https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_exception.rb#L1019
       }
     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_4
===================================================================
--- ruby_2_4	(revision 59490)
+++ ruby_2_4	(revision 59491)

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r59181

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]