objgenerator: If generator yielded STOP_ITERATION value, it's stopped.
MP_OBJ_STOP_ITERATION is equivalent of raising StopIteration, except mp_vm_return_kind_t for it is "yield".
This commit is contained in:
parent
5df81de7af
commit
aa9dbb1b03
@ -134,6 +134,9 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_
|
|||||||
|
|
||||||
case MP_VM_RETURN_YIELD:
|
case MP_VM_RETURN_YIELD:
|
||||||
*ret_val = *self->code_state.sp;
|
*ret_val = *self->code_state.sp;
|
||||||
|
if (*ret_val == MP_OBJ_STOP_ITERATION) {
|
||||||
|
self->code_state.ip = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_VM_RETURN_EXCEPTION:
|
case MP_VM_RETURN_EXCEPTION:
|
||||||
|
Loading…
Reference in New Issue
Block a user