py/runtime: Fix PEP479 behaviour throwing StopIteration into yield from.
Commit 3f6ffe059f implemented PEP479 but did
not catch the case fixed in this commit. Found by coverage analysis, that
the VM had uncovered code.
This commit is contained in:
11
py/vm.c
11
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user