summaryrefslogtreecommitdiff
path: root/py/emitbc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-01-17 14:32:50 +1100
committerDamien George <damien.p.george@gmail.com>2017-02-16 18:38:06 +1100
commit6e769da0da2ae24cbdab50c57f0d088e137146e3 (patch)
tree708d50659e4f8b5aee1946889d70b5ae587e1c70 /py/emitbc.c
parentf4df3aaa72a0460614b1ab8b7b8a7927a1165e31 (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/emitbc.c')
-rw-r--r--py/emitbc.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index 3e0c0b397..0d7e6519b 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -788,12 +788,7 @@ void mp_emit_bc_for_iter(emit_t *emit, mp_uint_t label) {
}
void mp_emit_bc_for_iter_end(emit_t *emit, bool use_stack) {
- emit_bc_pre(emit, -1);
- if (use_stack) {
- for (size_t i = 0; i < sizeof(mp_obj_iter_buf_t) / sizeof(mp_obj_t); ++i) {
- mp_emit_bc_pop_top(emit);
- }
- }
+ emit_bc_pre(emit, use_stack ? -1 - sizeof(mp_obj_iter_buf_t) / sizeof(mp_obj_t) : -1);
}
void mp_emit_bc_pop_block(emit_t *emit) {