diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 21 | ||||
-rw-r--r-- | vm_insnhelper.c | 5 |
3 files changed, 9 insertions, 22 deletions
@@ -1,3 +1,8 @@ +Sat Dec 4 08:25:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * vm_insnhelper.c (vm_call_method): revert r30064 and r30071, + because of [ruby-core:26761]. Bug#4106 rejected. + Sat Dec 4 07:46:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/mkmf.rb (String#tr_cpp): substitute * with P like as diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index e5177d6217..da17ef5e9c 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -411,25 +411,4 @@ class TestMethod < Test::Unit::TestCase assert_nothing_raised { v.instance_eval { mv2 } } assert_nothing_raised { v.instance_eval { mv3 } } end - - def test_protected_singleton - bug4106 = '[ruby-core:33506]' - a = Class.new do - def meth - :called - end - def test - a = dup - a.extend(Module.new) - a.extend(Module.new) - class << a - protected :meth - end - a.meth - end - end.new - called = nil - assert_nothing_raised(NoMethodError, bug4106) {called = a.test} - assert_equal(:called, called, bug4106) - end end diff --git a/vm_insnhelper.c b/vm_insnhelper.c index cc01cdf7ef..0ae0aec714 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -629,7 +629,10 @@ 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; - defined_class = rb_class_real(defined_class); + if (RB_TYPE_P(defined_class, T_ICLASS)) { + defined_class = RBASIC(defined_class)->klass; + } + if (!rb_obj_is_kind_of(cfp->self, defined_class)) { val = vm_method_missing(th, id, recv, num, blockptr, NOEX_PROTECTED); } |