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

ruby-changes:47116

From: usa <ko1@a...>
Date: Fri, 30 Jun 2017 21:14:00 +0900 (JST)
Subject: [ruby-changes:47116] usa:r59231 (ruby_2_3): merge revision(s) 59080, 59082: [Backport #13656]

usa	2017-06-30 21:13:56 +0900 (Fri, 30 Jun 2017)

  New Revision: 59231

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

  Log:
    merge revision(s) 59080,59082: [Backport #13656]
    
    proc.c: skip prepended modules
    
    * proc.c (method_super_method): skip prepended modules and
      continue from the super class of the original class.
      [ruby-core:81666] [Bug #13656]
    test/ruby/test_method.rb: refined  [ruby-core:81666] [Bug #13656]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/proc.c
    branches/ruby_2_3/test/ruby/test_method.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/test/ruby/test_method.rb
===================================================================
--- ruby_2_3/test/ruby/test_method.rb	(revision 59230)
+++ ruby_2_3/test/ruby/test_method.rb	(revision 59231)
@@ -905,6 +905,18 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_method.rb#L905
     assert_nil(m)
   end
 
+  def test_super_method_with_prepended_module
+    bug = '[ruby-core:81666] [Bug #13656] should be the method of the parent'
+    c1 = EnvUtil.labeled_class("C1") {def m; end}
+    c2 = EnvUtil.labeled_class("C2", c1) {def m; end}
+    c2.prepend(EnvUtil.labeled_module("M"))
+    m1 = c1.instance_method(:m)
+    m2 = c2.instance_method(:m).super_method
+    assert_equal(m1, m2, bug)
+    assert_equal(c1, m2.owner, bug)
+    assert_equal(m1.source_location, m2.source_location, bug)
+  end
+
   def rest_parameter(*rest)
     rest
   end
Index: ruby_2_3/proc.c
===================================================================
--- ruby_2_3/proc.c	(revision 59230)
+++ ruby_2_3/proc.c	(revision 59231)
@@ -2572,7 +2572,7 @@ method_super_method(VALUE method) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/proc.c#L2572
     const rb_method_entry_t *me;
 
     TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
-    super_class = RCLASS_SUPER(method_entry_defined_class(data->me));
+    super_class = RCLASS_SUPER(RCLASS_ORIGIN(method_entry_defined_class(data->me)));
     if (!super_class) return Qnil;
     me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(super_class, data->me->called_id);
     if (!me) return Qnil;
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 59230)
+++ ruby_2_3/version.h	(revision 59231)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.5"
 #define RUBY_RELEASE_DATE "2017-06-30"
-#define RUBY_PATCHLEVEL 327
+#define RUBY_PATCHLEVEL 328
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 59230)
+++ ruby_2_3/ChangeLog	(revision 59231)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Fri Jun 30 21:13:25 2017  Nobuyoshi Nakada  <nobu@r...>
+
+	* proc.c (method_super_method): skip prepended modules and continue from
+	  the super class of the original class. [Bug #13656]
+
 Fri Jun 30 21:10:48 2017  Shugo Maeda  <shugo@r...>
 
 	* lib/net/smtp.rb (getok, get_response): raise an ArgumentError when
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 59230)
+++ ruby_2_3	(revision 59231)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r59080,59082

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

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