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

gc.c: do not expose internal singleton class

* gc.c (internal_object_p): should not expose singleton classes
  without a metaclass.  based on patches by ko1 and shugo.
  [Bug #11740]
* class.c (rb_singleton_class_object_p): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-22 13:15:58 +00:00
parent 3f90a4ae1e
commit 96ac47c251
6 changed files with 56 additions and 1 deletions

View file

@ -149,5 +149,12 @@ End
}
assert(exist, 'Bug #11360')
End
klass = Class.new
instance = klass.new
sclass = instance.singleton_class
meta = klass.singleton_class
assert_kind_of(meta, sclass)
assert_include(ObjectSpace.each_object(meta).to_a, sclass)
end
end