From 2c5ae0eebad1397653f5dac5982cd5eba14ff35d Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 18 Aug 2007 07:48:28 +0000 Subject: * insnhelper.ci (vm_call_bmethod), vm.c (vm_invoke_proc_core): fix to do not restore $SAFE when proc invoked by bmethod. * vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index e65918a4a9..8cb97eead0 100644 --- a/vm.c +++ b/vm.c @@ -606,8 +606,8 @@ vm_yield(rb_thread_t *th, int argc, VALUE *argv) } VALUE -vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, - VALUE self, int argc, VALUE *argv) +vm_invoke_proc_core(rb_thread_t *th, rb_proc_t *proc, + VALUE self, int argc, VALUE *argv, int restore_safe) { VALUE val = Qundef; int state; @@ -623,7 +623,10 @@ vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, } TH_POP_TAG(); - th->safe_level = stored_safe; + if (restore_safe) { + th->safe_level = stored_safe; + } + lfp_set_special_cref(proc->block.lfp, (NODE*)stored_special_cref_stack); if (state) { @@ -647,6 +650,13 @@ vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, return val; } +VALUE +vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, + VALUE self, int argc, VALUE *argv) +{ + return vm_invoke_proc_core(th, proc, self, argc, argv, 1); +} + /* special variable */ VALUE -- cgit v1.2.3