From: Tomoyuki Chikanaga Date: 2010-12-03T19:53:11+09:00 Subject: [ruby-core:33545] [Ruby 1.9-Bug#4106] 1.9.2 regression - invoking protected singleton methods Issue #4106 has been updated by Tomoyuki Chikanaga. Hi After r30064, invoking method still cause NoMethodError if an object has been 'extend'ed. -- test code module M end class A def meth :called end def test a = dup a.extend M class << a protected :meth end a.meth end end o = A.new p o.test -- patch diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6ec6026..968bf10 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -630,7 +630,9 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, VALUE defined_class = me->klass; if (FL_TEST(defined_class, FL_SINGLETON)) { - defined_class = RCLASS_SUPER(defined_class); + do { + defined_class = RCLASS_SUPER(defined_class); + } while(RB_TYPE_P(defined_class, T_ICLASS)); } else if (RB_TYPE_P(defined_class, T_ICLASS)) { defined_class = RBASIC(defined_class)->klass; ---------------------------------------- http://redmine.ruby-lang.org/issues/show/4106 ---------------------------------------- http://redmine.ruby-lang.org