From 0b9f01644bedd7d775fa7b7c04f9957b3919b13b Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 30 Apr 2014 07:26:33 +0000 Subject: merge revision(s) 45367,45387,45388,45389: [Backport #9475] * vm_method.c (rb_method_entry_get_without_cache): me->klass is 0 for a method aliased in a module. [ruby-core:61636] [Bug #9663] * 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/branches/ruby_2_0_0@45750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_method.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'vm_method.c') diff --git a/vm_method.c b/vm_method.c index 8065efb311..8af656cd1e 100644 --- a/vm_method.c +++ b/vm_method.c @@ -534,8 +534,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 && me->klass) { + 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) { struct cache_entry *ent; -- cgit v1.2.3