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

ruby-changes:28229

From: nagachika <ko1@a...>
Date: Sun, 14 Apr 2013 02:20:08 +0900 (JST)
Subject: [ruby-changes:28229] nagachika:r40281 (ruby_2_0_0): merge revision(s) 39877,39881: [Backport #8153] [Backport #8154]

nagachika	2013-04-14 02:19:57 +0900 (Sun, 14 Apr 2013)

  New Revision: 40281

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

  Log:
    merge revision(s) 39877,39881: [Backport #8153] [Backport #8154]
    
    * array.c: Avoid zip bug by not using obsolete rb_check_block_call
      [Bug #8153]
    
    * vm_eval.c (check_funcall_respond_to): preserve passed_block, which
      is modified in vm_call0_body() via vm_call0(), and caused a bug of
      rb_check_funcall() by false negative result of rb_block_given_p().
      re-fix [ruby-core:53650] [Bug #8153].
      [ruby-core:53653] [Bug #8154]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_array.rb
    branches/ruby_2_0_0/version.h
    branches/ruby_2_0_0/vm_eval.c

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 40280)
+++ ruby_2_0_0/ChangeLog	(revision 40281)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sun Apr 14 02:13:25 2013  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* vm_eval.c (check_funcall_respond_to): preserve passed_block, which
+	  is modified in vm_call0_body() via vm_call0(), and caused a bug of
+	  rb_check_funcall() by false negative result of rb_block_given_p().
+	  re-fix [ruby-core:53650] [Bug #8153].
+	  [ruby-core:53653] [Bug #8154]
+
 Fri Apr 12 04:16:30 2013  Naohisa Goto  <ngotogenome@g...>
 
 	* marshal.c (marshal_dump, marshal_load): workaround for segv on
Index: ruby_2_0_0/vm_eval.c
===================================================================
--- ruby_2_0_0/vm_eval.c	(revision 40280)
+++ ruby_2_0_0/vm_eval.c	(revision 40281)
@@ -358,7 +358,8 @@ check_funcall_respond_to(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_eval.c#L358
     const rb_method_entry_t *me = rb_method_entry(klass, idRespond_to, &defined_class);
 
     if (me && !(me->flag & NOEX_BASIC)) {
-	VALUE args[2];
+	const rb_block_t *passed_block = th->passed_block;
+	VALUE args[2], result;
 	int arity = rb_method_entry_arity(me);
 
 	if (arity > 2)
@@ -368,7 +369,9 @@ check_funcall_respond_to(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_eval.c#L369
 
 	args[0] = ID2SYM(mid);
 	args[1] = Qtrue;
-	if (!RTEST(vm_call0(th, recv, idRespond_to, arity, args, me, defined_class))) {
+	result = vm_call0(th, recv, idRespond_to, arity, args, me, defined_class);
+	th->passed_block = passed_block;
+	if (!RTEST(result)) {
 	    return FALSE;
 	}
     }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40280)
+++ ruby_2_0_0/version.h	(revision 40281)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-04-13"
-#define RUBY_PATCHLEVEL 121
+#define RUBY_RELEASE_DATE "2013-04-14"
+#define RUBY_PATCHLEVEL 122
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 4
-#define RUBY_RELEASE_DAY 13
+#define RUBY_RELEASE_DAY 14
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_array.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_array.rb	(revision 40280)
+++ ruby_2_0_0/test/ruby/test_array.rb	(revision 40281)
@@ -1918,6 +1918,15 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_array.rb#L1918
     assert_equal([['a', 5], ['b', 6]], %w(a b).zip(ary))
   end
 
+  def test_zip_bug
+    bug8153 = "ruby-core:53650"
+    r = 1..1
+    def r.respond_to?(*)
+      super
+    end
+    assert_equal [[42, 1]], [42].zip(r), bug8153
+  end
+
   def test_transpose
     assert_equal([[1, :a], [2, :b], [3, :c]],
       [[1, 2, 3], [:a, :b, :c]].transpose)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39877,39881


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

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