summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-05-25 20:35:57 +1000
committerDamien George <damien.p.george@gmail.com>2017-05-25 20:35:57 +1000
commit68e71eacb8f5e67f9765ccd8639ca359bc3417de (patch)
tree0da62cd2f8475dfda7803b108665fcea48d70cf3 /py
parent982e67690216a04d82c9cfcb07e8c5e3dbc4d964 (diff)
downloadmicropython-68e71eacb8f5e67f9765ccd8639ca359bc3417de.tar.gz
micropython-68e71eacb8f5e67f9765ccd8639ca359bc3417de.zip
py/vm: Fix bug with stackless mode and unwinding of exceptions.
This patch fixes a regression introduced by 71a3d6ec3bd02c5bd13334537e1bd146bb643bad Previous to this patch the n_state variable was referring to that computed at the very start of the mp_execute_bytecode function. This patch fixes it so that n_state is recomputed when the code_state changes.
Diffstat (limited to 'py')
-rw-r--r--py/vm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/py/vm.c b/py/vm.c
index 469528df41..9704bc15ac 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -1436,6 +1436,7 @@ unwind_loop:
} else if (code_state->prev != NULL) {
mp_globals_set(code_state->old_globals);
code_state = code_state->prev;
+ size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
fastn = &code_state->state[n_state - 1];
exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
// variables that are visible to the exception handler (declared volatile)