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

ruby-changes:28575

From: nagachika <ko1@a...>
Date: Thu, 9 May 2013 23:55:55 +0900 (JST)
Subject: [ruby-changes:28575] nagachika:r40627 (ruby_2_0_0): merge revision(s) 40612,40614: [Backport #8025]

nagachika	2013-05-09 23:54:27 +0900 (Thu, 09 May 2013)

  New Revision: 40627

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

  Log:
    merge revision(s) 40612,40614: [Backport #8025]
    
    * class.c (rb_mod_included_modules): should not include the original
      module itself.  [ruby-core:53158] [Bug #8025]
    
    * class.c (rb_mod_included_modules): should not include non-modules.
      [ruby-core:53158] [Bug #8025]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/class.c
    branches/ruby_2_0_0/test/ruby/test_module.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 40626)
+++ ruby_2_0_0/ChangeLog	(revision 40627)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Thu May  9 23:39:47 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* class.c (rb_mod_included_modules): should not include non-modules.
+	  [ruby-core:53158] [Bug #8025]
+
+Thu May  9 23:39:47 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* class.c (rb_mod_included_modules): should not include the original
+	  module itself.  [ruby-core:53158] [Bug #8025]
+
 Wed May  8 23:07:19 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* insns.def (defined): use vm_search_superclass() like as normal super
Index: ruby_2_0_0/class.c
===================================================================
--- ruby_2_0_0/class.c	(revision 40626)
+++ ruby_2_0_0/class.c	(revision 40627)
@@ -853,10 +853,13 @@ rb_mod_included_modules(VALUE mod) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/class.c#L853
 {
     VALUE ary = rb_ary_new();
     VALUE p;
+    VALUE origin = RCLASS_ORIGIN(mod);
 
     for (p = RCLASS_SUPER(mod); p; p = RCLASS_SUPER(p)) {
-	if (BUILTIN_TYPE(p) == T_ICLASS) {
-	    rb_ary_push(ary, RBASIC(p)->klass);
+	if (p != origin && BUILTIN_TYPE(p) == T_ICLASS) {
+	    VALUE m = RBASIC(p)->klass;
+	    if (RB_TYPE_P(m, T_MODULE))
+		rb_ary_push(ary, m);
 	}
     }
     return ary;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40626)
+++ ruby_2_0_0/version.h	(revision 40627)
@@ -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-05-08"
-#define RUBY_PATCHLEVEL 188
+#define RUBY_RELEASE_DATE "2013-05-09"
+#define RUBY_PATCHLEVEL 189
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 8
+#define RUBY_RELEASE_DAY 9
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_module.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_module.rb	(revision 40626)
+++ ruby_2_0_0/test/ruby/test_module.rb	(revision 40627)
@@ -1508,6 +1508,21 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1508
     assert_nothing_raised(NoMethodError) {a.send :foo}
   end
 
+  def test_prepend_included_modules
+    bug8025 = '[ruby-core:53158] [Bug #8025]'
+    mixin = labeled_module("mixin")
+    c = labeled_module("c") {prepend mixin}
+    im = c.included_modules
+    assert_not_include(im, c, bug8025)
+    assert_include(im, mixin, bug8025)
+    c1 = labeled_class("c1") {prepend mixin}
+    c2 = labeled_class("c2", c1)
+    im = c2.included_modules
+    assert_not_include(im, c1, bug8025)
+    assert_not_include(im, c2, bug8025)
+    assert_include(im, mixin, bug8025)
+  end
+
   def test_class_variables
     m = Module.new
     m.class_variable_set(:@@foo, 1)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40612,40614


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

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