summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-14 08:20:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-14 08:20:10 +0000
commit160b67df68655322d09f566914c89e2d3e7cfc05 (patch)
tree08adf254d814eae020422f183addabdbf9cec95b /proc.c
parentc2a7a091cc8cf9352a6df05591788b6a8c0134ad (diff)
proc.c: use already included ancestor iclass
* proc.c (umethod_bind): use the ancestor iclass instead of new iclass to get rid of infinite recursion, if the defined module is already included. [ruby-core:62014] [Bug #9721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index 1271a3ba42..8153cc9cfd 100644
--- a/proc.c
+++ b/proc.c
@@ -2044,7 +2044,13 @@ umethod_bind(VALUE method, VALUE recv)
if (bound->me->def) bound->me->def->alias_count++;
rclass = CLASS_OF(recv);
if (BUILTIN_TYPE(bound->defined_class) == T_MODULE) {
- rclass = rb_include_class_new(methclass, rclass);
+ VALUE ic = rb_class_search_ancestor(rclass, bound->defined_class);
+ if (ic) {
+ rclass = ic;
+ }
+ else {
+ rclass = rb_include_class_new(methclass, rclass);
+ }
}
bound->recv = recv;
bound->rclass = rclass;