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

ruby-changes:28523

From: nagachika <ko1@a...>
Date: Sat, 4 May 2013 23:48:33 +0900 (JST)
Subject: [ruby-changes:28523] nagachika:r40575 (ruby_2_0_0): merge revision(s) 40561: [Backport #8357]

nagachika	2013-05-04 23:48:20 +0900 (Sat, 04 May 2013)

  New Revision: 40575

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

  Log:
    merge revision(s) 40561: [Backport #8357]
    
    * object.c (rb_obj_is_kind_of): skip prepending modules.
      [ruby-core:54742] [Bug #8357]
    
    * object.c (rb_class_inherited_p): ditto.
      [ruby-core:54736] [Bug #8357]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/object.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 40574)
+++ ruby_2_0_0/ChangeLog	(revision 40575)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat May  4 23:44:54 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* object.c (rb_obj_is_kind_of): skip prepending modules.
+	  [ruby-core:54742] [Bug #8357]
+
+	* object.c (rb_class_inherited_p): ditto.
+	  [ruby-core:54736] [Bug #8357]
+
 Thu May  2 23:39:45 2013  Tanaka Akira  <akr@f...>
 
 	* thread.c (double2timeval): convert the infinity to TIME_MAX to avoid
Index: ruby_2_0_0/object.c
===================================================================
--- ruby_2_0_0/object.c	(revision 40574)
+++ ruby_2_0_0/object.c	(revision 40575)
@@ -584,6 +584,7 @@ rb_obj_is_kind_of(VALUE obj, VALUE c) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L584
     VALUE cl = CLASS_OF(obj);
 
     c = class_or_module_required(c);
+    c = RCLASS_ORIGIN(c);
     while (cl) {
 	if (cl == c || RCLASS_M_TBL(cl) == RCLASS_M_TBL(c))
 	    return Qtrue;
@@ -1465,6 +1466,7 @@ rb_class_inherited_p(VALUE mod, VALUE ar https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L1466
     if (!CLASS_OR_MODULE_P(arg)) {
 	rb_raise(rb_eTypeError, "compared with non class/module");
     }
+    arg = RCLASS_ORIGIN(arg);
     while (mod) {
 	if (RCLASS_M_TBL(mod) == RCLASS_M_TBL(arg))
 	    return Qtrue;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40574)
+++ ruby_2_0_0/version.h	(revision 40575)
@@ -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-02"
-#define RUBY_PATCHLEVEL 181
+#define RUBY_RELEASE_DATE "2013-05-04"
+#define RUBY_PATCHLEVEL 182
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 2
+#define RUBY_RELEASE_DAY 4
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_module.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_module.rb	(revision 40574)
+++ ruby_2_0_0/test/ruby/test_module.rb	(revision 40575)
@@ -1368,6 +1368,13 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1368
     c = labeled_class("c") {prepend b}
     assert_operator(c, :<, b, bug6654)
     assert_operator(c, :<, a, bug6654)
+    bug8357 = '[ruby-core:54736] [Bug #8357]'
+    b = labeled_module("b") {prepend a}
+    c = labeled_class("c") {include b}
+    assert_operator(c, :<, b, bug8357)
+    assert_operator(c, :<, a, bug8357)
+    bug8357 = '[ruby-core:54742] [Bug #8357]'
+    assert_kind_of(b, c.new, bug8357)
   end
 
   def test_prepend_instance_methods
@@ -1447,14 +1454,14 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L1454
 
   def labeled_module(name, &block)
     Module.new do
-      singleton_class.class_eval {define_method(:to_s) {name}}
+      singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
       class_eval(&block) if block
     end
   end
 
   def labeled_class(name, superclass = Object, &block)
     Class.new(superclass) do
-      singleton_class.class_eval {define_method(:to_s) {name}}
+      singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
       class_eval(&block) if block
     end
   end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40561


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

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