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

ruby-changes:32432

From: nagachika <ko1@a...>
Date: Tue, 7 Jan 2014 01:35:56 +0900 (JST)
Subject: [ruby-changes:32432] nagachika:r44511 (ruby_2_0_0): merge revision(s) 44455, 44458, 44510: [Backport #9315]

nagachika	2014-01-07 01:35:45 +0900 (Tue, 07 Jan 2014)

  New Revision: 44511

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

  Log:
    merge revision(s) 44455,44458,44510: [Backport #9315]
    
    * vm_insnhelper.c (vm_search_super_method): direct superclass of a
      module is found when super called in a Method object generated a
      method defined in a module, call method_missing in that case.
      [ruby-core:59358] [Bug #9315]
    
    * proc.c (mnew_from_me): keep iclass as-is, to make inheritance
      chain consistent.  [ruby-core:59358] [Bug #9315]
    
    * proc.c (method_owner): return the original defined_class from
      prepended iclass, instead.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/proc.c
    branches/ruby_2_0_0/test/ruby/test_super.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 44510)
+++ ruby_2_0_0/ChangeLog	(revision 44511)
@@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue Jan  7 01:16:34 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* proc.c (mnew_from_me): keep iclass as-is, to make inheritance
+	  chain consistent.  [ruby-core:59358] [Bug #9315]
+
+	* proc.c (method_owner): return the original defined_class from
+	  prepended iclass, instead.
+
+Tue Jan  7 01:16:34 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_insnhelper.c (vm_search_super_method): direct superclass of a
+	  module is found when super called in a Method object generated a
+	  method defined in a module, call method_missing in that case.
+	  [ruby-core:59358] [Bug #9315]
+
 Fri Jan  3 22:25:23 2014  Aman Gupta <ruby@t...>
 
 	* test/net/imap/cacert.pem: generate new CA cert, since the last one
Index: ruby_2_0_0/proc.c
===================================================================
--- ruby_2_0_0/proc.c	(revision 44510)
+++ ruby_2_0_0/proc.c	(revision 44511)
@@ -992,10 +992,6 @@ mnew(VALUE klass, VALUE obj, ID id, VALU https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/proc.c#L992
 	goto again;
     }
 
-    if (RB_TYPE_P(defined_class, T_ICLASS)) {
-	defined_class = RBASIC(defined_class)->klass;
-    }
-
     klass = defined_class;
 
     while (rclass != klass &&
@@ -1173,9 +1169,16 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/proc.c#L1169
 method_owner(VALUE obj)
 {
     struct METHOD *data;
+    VALUE defined_class;
 
     TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
-    return data->defined_class;
+    defined_class = data->defined_class;
+
+    if (RB_TYPE_P(defined_class, T_ICLASS)) {
+	defined_class = RBASIC(defined_class)->klass;
+    }
+
+    return defined_class;
 }
 
 void
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 44510)
+++ ruby_2_0_0/version.h	(revision 44511)
@@ -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 "2014-01-03"
-#define RUBY_PATCHLEVEL 377
+#define RUBY_RELEASE_DATE "2014-01-07"
+#define RUBY_PATCHLEVEL 378
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 3
+#define RUBY_RELEASE_DAY 7
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_super.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_super.rb	(revision 44510)
+++ ruby_2_0_0/test/ruby/test_super.rb	(revision 44511)
@@ -408,4 +408,37 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_super.rb#L408
     assert_equal([false, false], y.foo(false, false))
     assert_equal([1, 2, 3, false, 5], y.foo(1, 2, 3, false, 5))
   end
+
+  def test_missing_super_in_method_module
+    bug9315 = '[ruby-core:59358] [Bug #9315]'
+    a = Module.new do
+      def foo
+        super
+      end
+    end
+    b = Class.new do
+      include a
+    end
+    assert_raise(NoMethodError, bug9315) do
+      b.new.method(:foo).call
+    end
+  end
+
+  def test_module_super_in_method_module
+    bug9315 = '[ruby-core:59589] [Bug #9315]'
+    a = Module.new do
+      def foo
+        super
+      end
+    end
+    c = Class.new do
+      def foo
+        :ok
+      end
+    end
+    o = c.new.extend(a)
+    assert_nothing_raised(NoMethodError, bug9315) do
+      assert_equal(:ok, o.method(:foo).call, bug9315)
+    end
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44455,44458,44510


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

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