ruby-changes:72282
From: John <ko1@a...>
Date: Wed, 22 Jun 2022 10:34:11 +0900 (JST)
Subject: [ruby-changes:72282] a580dd7737 (master): Don't check protected method ancestry on fcall
https://git.ruby-lang.org/ruby.git/commit/?id=a580dd7737 From a580dd77377c87754b437efb1a02cccc1554dafd Mon Sep 17 00:00:00 2001 From: John Hawthorn <john@h...> Date: Thu, 16 Jun 2022 13:28:39 -0700 Subject: Don't check protected method ancestry on fcall If we are making an FCALL, we know we are calling a method on self. This is the same check made for private method visibility, so it should also guarantee we can call a protected method. --- vm_insnhelper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm_insnhelper.c b/vm_insnhelper.c index d2f3fc62bd..248a59f642 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3749,7 +3749,7 @@ vm_call_method(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_ca https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3749 return vm_call_method_each_type(ec, cfp, calling); case METHOD_VISI_PROTECTED: - if (!(vm_ci_flag(ci) & VM_CALL_OPT_SEND)) { + if (!(vm_ci_flag(ci) & (VM_CALL_OPT_SEND | VM_CALL_FCALL))) { VALUE defined_class = vm_defined_class_for_protected_call(vm_cc_cme(cc)); if (!rb_obj_is_kind_of(cfp->self, defined_class)) { vm_cc_method_missing_reason_set(cc, MISSING_PROTECTED); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/