summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-20 03:31:28 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-20 03:31:28 (GMT)
commit3453070fbc7e1d4294b6248ceebe22b7577d63dd (patch)
tree69d1f7f40df33dff10a0c54dfd3c35e20c8f53c2 /vm_method.c
parentaf723ec847e6fb012c72c804a180a44b33a2c223 (diff)
vm_method.c: fix infinite recursion
* vm_method.c (rb_method_entry_get_without_cache): get rid of infinite recursion at aliases in a subclass and a superclass. return actually defined class for other than singleton class. [ruby-core:60431] [Bug #9475] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c
index ff694ea..2279190 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -578,8 +578,15 @@ rb_method_entry_get_without_cache(VALUE klass, ID id,
VALUE defined_class;
rb_method_entry_t *me = search_method(klass, id, &defined_class);
- if (me && RB_TYPE_P(me->klass, T_ICLASS))
- defined_class = me->klass;
+ if (me) {
+ switch (BUILTIN_TYPE(me->klass)) {
+ case T_CLASS:
+ if (RBASIC(klass)->flags & FL_SINGLETON) break;
+ /* fall through */
+ case T_ICLASS:
+ defined_class = me->klass;
+ }
+ }
if (ruby_running) {
if (OPT_GLOBAL_METHOD_CACHE) {