local_variables() should not touch unshared env

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-23 20:50:14 +09:00
parent efebbbbf26
commit bfbc6b9ea4
+2 -1
View File
@@ -1078,7 +1078,8 @@ mrb_local_variables(mrb_state *mrb, mrb_value self)
struct REnv *e = proc->env;
while (e) {
if (!MRB_PROC_CFUNC_P(mrb->c->cibase[e->cioff].proc)) {
if (MRB_ENV_STACK_SHARED_P(e) &&
!MRB_PROC_CFUNC_P(mrb->c->cibase[e->cioff].proc)) {
irep = mrb->c->cibase[e->cioff].proc->body.irep;
if (irep->lv) {
for (i = 0; i + 1 < irep->nlocals; ++i) {