diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 8 |
3 files changed, 8 insertions, 7 deletions
@@ -1,3 +1,8 @@ +Fri Dec 3 22:36:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * vm_insnhelper.c (vm_call_method): protected methods should be + checked against the real class. + Fri Dec 3 20:23:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/mkmf.rb (convertible_int): define printf format prefix too. diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 2f3ba3ebd6..e5177d6217 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -420,6 +420,8 @@ class TestMethod < Test::Unit::TestCase end def test a = dup + a.extend(Module.new) + a.extend(Module.new) class << a protected :meth end diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6ec6026e37..cc01cdf7ef 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -629,13 +629,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, else if (!(flag & VM_CALL_OPT_SEND_BIT) && (me->flag & NOEX_MASK) & NOEX_PROTECTED) { VALUE defined_class = me->klass; - if (FL_TEST(defined_class, FL_SINGLETON)) { - defined_class = RCLASS_SUPER(defined_class); - } - else if (RB_TYPE_P(defined_class, T_ICLASS)) { - defined_class = RBASIC(defined_class)->klass; - } - + defined_class = rb_class_real(defined_class); if (!rb_obj_is_kind_of(cfp->self, defined_class)) { val = vm_method_missing(th, id, recv, num, blockptr, NOEX_PROTECTED); } |