From 771cb359af5242762baa29645c37cafa23c47b25 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 May 2018 16:39:19 +1000 Subject: [PATCH] py/objgenerator: Save state in old_globals instead of local variable. The code_state.old_globals variable is there to save the globals state so should be used for this purpose, to avoid the need for additional local variables on the C stack. --- py/objgenerator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/objgenerator.c b/py/objgenerator.c index 5fd13f831d..d500dbd9d9 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -117,10 +117,10 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_ *self->code_state.sp = send_value; } } - mp_obj_dict_t *old_globals = mp_globals_get(); + self->code_state.old_globals = mp_globals_get(); mp_globals_set(self->globals); mp_vm_return_kind_t ret_kind = mp_execute_bytecode(&self->code_state, throw_value); - mp_globals_set(old_globals); + mp_globals_set(self->code_state.old_globals); switch (ret_kind) { case MP_VM_RETURN_NORMAL: