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

ruby-changes:40638

From: nagachika <ko1@a...>
Date: Mon, 23 Nov 2015 00:40:55 +0900 (JST)
Subject: [ruby-changes:40638] nagachika:r52717 (ruby_2_2): merge revision(s) 51651, 51655: [Backport #11451]

nagachika	2015-11-23 00:40:37 +0900 (Mon, 23 Nov 2015)

  New Revision: 52717

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

  Log:
    merge revision(s) 51651,51655: [Backport #11451]
    
    * vm_insnhelper.c (vm_invoke_block): we should not expect ci->argc is
      stable after invoking a block. [Bug #11451]
    
    * test/ruby/test_yield.rb: add a test. This test script is given by
      Alex Dowad.

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/test/ruby/test_yield.rb
    branches/ruby_2_2/version.h
    branches/ruby_2_2/vm_insnhelper.c
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 52716)
+++ ruby_2_2/ChangeLog	(revision 52717)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Mon Nov 23 00:19:51 2015  Koichi Sasada  <ko1@a...>
+
+	* vm_insnhelper.c (vm_invoke_block): we should not expect ci->argc is
+	  stable after invoking a block. [Bug #11451]
+
+	* test/ruby/test_yield.rb: add a test. This test script is given by
+	  Alex Dowad.
+
 Thu Nov 19 01:06:07 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* load.c (rb_load_internal0): stop separating exits at loading
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 52716)
+++ ruby_2_2/version.h	(revision 52717)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.4"
-#define RUBY_RELEASE_DATE "2015-11-19"
-#define RUBY_PATCHLEVEL 193
+#define RUBY_RELEASE_DATE "2015-11-23"
+#define RUBY_PATCHLEVEL 194
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 19
+#define RUBY_RELEASE_DAY 23
 
 #include "ruby/version.h"
 
Index: ruby_2_2/vm_insnhelper.c
===================================================================
--- ruby_2_2/vm_insnhelper.c	(revision 52716)
+++ ruby_2_2/vm_insnhelper.c	(revision 52717)
@@ -2094,10 +2094,11 @@ vm_invoke_block(rb_thread_t *th, rb_cont https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm_insnhelper.c#L2094
     }
     else {
 	VALUE val;
+	int argc;
 	CALLER_SETUP_ARG(th->cfp, ci);
-	val = vm_yield_with_cfunc(th, block, block->self, block->klass,
-				  ci->argc, STACK_ADDR_FROM_TOP(ci->argc), 0);
-	POPN(ci->argc); /* TODO: should put before C/yield? */
+	argc = ci->argc;
+	val = vm_yield_with_cfunc(th, block, block->self, block->klass, argc, STACK_ADDR_FROM_TOP(argc), 0);
+	POPN(argc); /* TODO: should put before C/yield? */
 	return val;
     }
 }
Index: ruby_2_2/test/ruby/test_yield.rb
===================================================================
--- ruby_2_2/test/ruby/test_yield.rb	(revision 52716)
+++ ruby_2_2/test/ruby/test_yield.rb	(revision 52717)
@@ -390,4 +390,28 @@ class TestRubyYieldGen < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_yield.rb#L390
     end
     assert_equal [m, nil], y.s(m){|a,b|[a,b]}
   end
+
+  def test_block_cached_argc
+    # [Bug #11451]
+    assert_separately([], <<-"end;")
+      class Yielder
+        def each
+          yield :x, :y, :z
+        end
+      end
+      class Getter1
+        include Enumerable
+        def each(&block)
+          Yielder.new.each(&block)
+        end
+      end
+      class Getter2
+        include Enumerable
+        def each
+          Yielder.new.each { |a, b, c, d| yield(a) }
+        end
+      end
+      Getter1.new.map{Getter2.new.each{|x|}}
+    end;
+  end
 end

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51651,51655


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

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