diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-09 14:54:27 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-09 14:54:27 +0000 |
commit | 2c240c5e49e618f769d8c8082ab9c4d088f68411 (patch) | |
tree | 440ca32c67b210c68ea9dd70bf3130a4f92e1855 /class.c | |
parent | 4c1f8acd2ac14ffce1e1d9f414c700f293a7bdc6 (diff) |
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
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |