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

Use proc_binding rather than rb_funcall

FIX
This commit is contained in:
Chris Seaton 2020-10-05 23:51:34 +01:00 committed by Aaron Patterson
parent ee7cc6ac35
commit fef52122b0
Notes: git 2020-10-07 07:42:18 +09:00

3
proc.c
View file

@ -48,6 +48,7 @@ VALUE rb_cProc;
static rb_block_call_func bmcall; static rb_block_call_func bmcall;
static int method_arity(VALUE); static int method_arity(VALUE);
static int method_min_max_arity(VALUE, int *max); static int method_min_max_arity(VALUE, int *max);
static VALUE proc_binding(VALUE self);
#define attached id__attached__ #define attached id__attached__
@ -2743,7 +2744,7 @@ VALUE
rb_callable_receiver(VALUE callable) rb_callable_receiver(VALUE callable)
{ {
if (rb_obj_is_proc(callable)) { if (rb_obj_is_proc(callable)) {
VALUE binding = rb_funcall(callable, rb_intern("binding"), 0); VALUE binding = proc_binding(callable);
return rb_funcall(binding, rb_intern("receiver"), 0); return rb_funcall(binding, rb_intern("receiver"), 0);
} }
else if (rb_obj_is_method(callable)) { else if (rb_obj_is_method(callable)) {