aboutsummaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-30 16:06:20 +1000
committerDamien George <damien.p.george@gmail.com>2019-10-04 23:27:00 +1000
commit809d89c794ceb44760ab997ff9a496488b4a2c0c (patch)
tree73d64b0977c0bc078144cbff18a47e4db86ff0ca /py/vm.c
parent82c494a97e874912e7eb23d2f03f39212e343fb3 (diff)
py/runtime: Fix PEP479 behaviour throwing StopIteration into yield from.
Commit 3f6ffe059f64b3ebc44dc0bbc63452cb8850702b implemented PEP479 but did not catch the case fixed in this commit. Found by coverage analysis, that the VM had uncovered code.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/py/vm.c b/py/vm.c
index 6e5015fc4..7c702f386 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -1266,17 +1266,10 @@ yield:
DISPATCH();
} else {
assert(ret_kind == MP_VM_RETURN_EXCEPTION);
+ assert(!EXC_MATCH(ret_value, MP_OBJ_FROM_PTR(&mp_type_StopIteration)));
// Pop exhausted gen
sp--;
- if (EXC_MATCH(ret_value, MP_OBJ_FROM_PTR(&mp_type_StopIteration))) {
- PUSH(mp_obj_exception_get_value(ret_value));
- // If we injected GeneratorExit downstream, then even
- // if it was swallowed, we re-raise GeneratorExit
- GENERATOR_EXIT_IF_NEEDED(t_exc);
- DISPATCH();
- } else {
- RAISE(ret_value);
- }
+ RAISE(ret_value);
}
}