diff options
author | Damien George <damien.p.george@gmail.com> | 2017-01-17 14:32:50 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-02-16 18:38:06 +1100 |
commit | 6e769da0da2ae24cbdab50c57f0d088e137146e3 (patch) | |
tree | 708d50659e4f8b5aee1946889d70b5ae587e1c70 /py/vm.c | |
parent | f4df3aaa72a0460614b1ab8b7b8a7927a1165e31 (diff) |
py: Make FOR_ITER opcode pop 1+4 slots from the stack when finished.
The extra 4 slots correspond to the iterator object stored on the stack.
Diffstat (limited to 'py/vm.c')
-rw-r--r-- | py/vm.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -744,7 +744,7 @@ unwind_jump:; assert(TOP()); mp_obj_t value = mp_iternext_allow_raise(TOP()); if (value == MP_OBJ_STOP_ITERATION) { - --sp; // pop the exhausted iterator + sp -= 5; // pop the exhausted iterator ip += ulab; // jump to after for-block } else { PUSH(value); // push the next iteration value @@ -1294,7 +1294,7 @@ exception_handler: const byte *ip = code_state->ip + 1; DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward code_state->ip = ip + ulab; // jump to after for-block - code_state->sp -= 1; // pop the exhausted iterator + code_state->sp -= 5; // pop the exhausted iterator goto outer_dispatch_loop; // continue with dispatch loop } else if (*code_state->ip == MP_BC_YIELD_FROM) { // StopIteration inside yield from call means return a value of |