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

ruby-changes:39048

From: nagachika <ko1@a...>
Date: Sat, 4 Jul 2015 03:51:11 +0900 (JST)
Subject: [ruby-changes:39048] nagachika:r51129 (ruby_2_2): merge revision(s) 50850: [Backport #11254]

nagachika	2015-07-04 03:50:55 +0900 (Sat, 04 Jul 2015)

  New Revision: 51129

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

  Log:
    merge revision(s) 50850: [Backport #11254]
    
    vm.c: break from orphan block
    
    * vm.c (rb_vm_search_cf_from_ep): break from orphan block is
      possible condition, but not [BUG].
      [ruby-core:69548] [Bug #11254]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/test/ruby/test_enum.rb
    branches/ruby_2_2/version.h
    branches/ruby_2_2/vm.c
Index: ruby_2_2/vm.c
===================================================================
--- ruby_2_2/vm.c	(revision 51128)
+++ ruby_2_2/vm.c	(revision 51129)
@@ -44,7 +44,7 @@ rb_vm_search_cf_from_ep(const rb_thread_ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm.c#L44
 	    cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
 	}
 
-	rb_bug("rb_vm_search_cf_from_ep: no corresponding cfp");
+	return NULL;
     }
 }
 
@@ -1146,6 +1146,12 @@ vm_iter_break(rb_thread_t *th, VALUE val https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm.c#L1146
     VALUE *ep = VM_CF_PREV_EP(cfp);
     rb_control_frame_t *target_cfp = rb_vm_search_cf_from_ep(th, cfp, ep);
 
+#if 0				/* raise LocalJumpError */
+    if (!target_cfp) {
+	rb_vm_localjump_error("unexpected break", val, TAG_BREAK);
+    }
+#endif
+
     th->state = TAG_BREAK;
     th->errinfo = (VALUE)NEW_THROW_OBJECT(val, (VALUE)target_cfp, TAG_BREAK);
     TH_JUMP_TAG(th, TAG_BREAK);
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 51128)
+++ ruby_2_2/version.h	(revision 51129)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
-#define RUBY_RELEASE_DATE "2015-07-01"
-#define RUBY_PATCHLEVEL 139
+#define RUBY_RELEASE_DATE "2015-07-04"
+#define RUBY_PATCHLEVEL 140
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 1
+#define RUBY_RELEASE_DAY 4
 
 #include "ruby/version.h"
 
Index: ruby_2_2/test/ruby/test_enum.rb
===================================================================
--- ruby_2_2/test/ruby/test_enum.rb	(revision 51128)
+++ ruby_2_2/test/ruby/test_enum.rb	(revision 51129)
@@ -55,7 +55,8 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_enum.rb#L55
 
     bug5801 = '[ruby-dev:45041]'
     @empty.grep(//)
-    assert_nothing_raised(bug5801) {100.times {@empty.block.call}}
+    block = @empty.block
+    assert_nothing_raised(bug5801) {100.times {block.call}}
 
     a = []
     lambda = ->(x, i) {a << [x, i]}
@@ -173,6 +174,21 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_enum.rb#L174
     assert_equal(1, @obj.first)
     assert_equal([1, 2, 3], @obj.first(3))
     assert_nil(@empty.first)
+
+    bug5801 = '[ruby-dev:45041]'
+    assert_in_out_err([], <<-'end;', [], /unexpected break/)
+      empty = Object.new
+      class << empty
+        attr_reader :block
+        include Enumerable
+        def each(&block)
+          @block = block
+          self
+        end
+      end
+      empty.first
+      empty.block.call
+    end;
   end
 
   def test_sort
@@ -396,7 +412,8 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_enum.rb#L412
 
     bug5801 = '[ruby-dev:45040]'
     @empty.take_while {true}
-    assert_nothing_raised(bug5801) {100.times {@empty.block.call}}
+    block = @empty.block
+    assert_nothing_raised(bug5801) {100.times {block.call}}
   end
 
   def test_drop

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50850


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

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