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

ruby-changes:39239

From: ko1 <ko1@a...>
Date: Wed, 22 Jul 2015 04:05:48 +0900 (JST)
Subject: [ruby-changes:39239] ko1:r51320 (trunk): * gc.c (internal_object_p): Now a singleton classes appear by

ko1	2015-07-22 04:04:56 +0900 (Wed, 22 Jul 2015)

  New Revision: 51320

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

  Log:
    * gc.c (internal_object_p): Now a singleton classes appear by
      ObjectSpace.each_object. [Bug #11360]
    * test/ruby/test_objectspace.rb: add a test about it.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/test/ruby/test_objectspace.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51319)
+++ ChangeLog	(revision 51320)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jul 22 03:37:39 2015  Koichi Sasada  <ko1@a...>
+
+	* gc.c (internal_object_p): Now a singleton classes appear by
+	  ObjectSpace.each_object. [Bug #11360]
+
+	* test/ruby/test_objectspace.rb: add a test about it.
+
 Tue Jul 21 21:21:33 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (do_select): replace switch and goto with a loop to
Index: gc.c
===================================================================
--- gc.c	(revision 51319)
+++ gc.c	(revision 51320)
@@ -2319,9 +2319,6 @@ internal_object_p(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L2319
 	  case T_NODE:
 	  case T_ZOMBIE:
 	    break;
-	  case T_CLASS:
-	    if (FL_TEST(p, FL_SINGLETON))
-	      break;
 	  default:
 	    if (!p->as.basic.klass) break;
 	    return 0;
Index: test/ruby/test_objectspace.rb
===================================================================
--- test/ruby/test_objectspace.rb	(revision 51319)
+++ test/ruby/test_objectspace.rb	(revision 51320)
@@ -109,4 +109,20 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_objectspace.rb#L109
       p Thread.current[:__recursive_key__]
     end;
   end
+
+  def test_each_object_singleton_class
+    assert_separately([], <<-End)
+      class C
+        class << self
+          $c = self
+        end
+      end
+
+      exist = false
+      ObjectSpace.each_object(Class){|o|
+        exist = true if $c == o
+      }
+      assert(exist, 'Bug #11360')
+    End
+  end
 end

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

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