From 2c240c5e49e618f769d8c8082ab9c4d088f68411 Mon Sep 17 00:00:00 2001 From: nagachika Date: Thu, 9 May 2013 14:54:27 +0000 Subject: merge revision(s) 40612,40614: [Backport #8025] * class.c (rb_mod_included_modules): should not include the original module itself. [ruby-core:53158] [Bug #8025] * class.c (rb_mod_included_modules): should not include non-modules. [ruby-core:53158] [Bug #8025] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- class.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index 85ce5b88bb..f9f5dd84c2 100644 --- a/class.c +++ b/class.c @@ -853,10 +853,13 @@ rb_mod_included_modules(VALUE mod) { VALUE ary = rb_ary_new(); VALUE p; + VALUE origin = RCLASS_ORIGIN(mod); for (p = RCLASS_SUPER(mod); p; p = RCLASS_SUPER(p)) { - if (BUILTIN_TYPE(p) == T_ICLASS) { - rb_ary_push(ary, RBASIC(p)->klass); + if (p != origin && BUILTIN_TYPE(p) == T_ICLASS) { + VALUE m = RBASIC(p)->klass; + if (RB_TYPE_P(m, T_MODULE)) + rb_ary_push(ary, m); } } return ary; -- cgit v1.2.3