diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-03 13:36:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-03 13:36:49 +0000 |
commit | 7b0b9df60ec0fff1463b235779ad48cb8897956a (patch) | |
tree | 5276ac2a1667e9847819e347a35f4d6eb9e21d1e | |
parent | 9e3e0ca3fe5dbfb611445f266f30f72bc06fe3de (diff) |
* vm_insnhelper.c (vm_call_method): protected methods should be
checked against the real class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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); } |