From 6a5e63a71557428a68a576a0890e784a6dd12a25 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 16 Jun 2004 07:04:05 +0000 Subject: * object.c (rb_class_inherited_p): singleton class inherits Class rather than its object's class. [ruby-dev:23690] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- object.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'object.c') diff --git a/object.c b/object.c index 2fb2bd0638..f2c8c5f522 100644 --- a/object.c +++ b/object.c @@ -1257,6 +1257,11 @@ rb_class_inherited_p(mod, arg) rb_raise(rb_eTypeError, "compared with non class/module"); } + if (FL_TEST(mod, FL_SINGLETON)) { + if (RCLASS(mod)->m_tbl == RCLASS(arg)->m_tbl) + return Qtrue; + mod = RBASIC(mod)->klass; + } while (mod) { if (RCLASS(mod)->m_tbl == RCLASS(arg)->m_tbl) return Qtrue; -- cgit v1.2.3