1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2010-12-03 13:36:49 +00:00
parent 9e3e0ca3fe
commit 7b0b9df60e
3 changed files with 8 additions and 7 deletions

View file

@ -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.

View file

@ -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

View file

@ -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);
}