1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-07-21 19:04:56 +00:00
parent 0fceffce7e
commit 46215c1e90
3 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,10 @@
Wed Jul 22 03:37:39 2015 Koichi Sasada <ko1@atdot.net>
* 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@ruby-lang.org>
* thread.c (do_select): replace switch and goto with a loop to

3
gc.c
View file

@ -2319,9 +2319,6 @@ internal_object_p(VALUE obj)
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;

View file

@ -109,4 +109,20 @@ End
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