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:
Paul Sokolovsky 2015-05-11 02:59:25 +03:00 committed by Damien George
parent 5df81de7af
commit aa9dbb1b03
1 changed files with 3 additions and 0 deletions

View File

@ -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:
*ret_val = *self->code_state.sp;
if (*ret_val == MP_OBJ_STOP_ITERATION) {
self->code_state.ip = 0;
}
break;
case MP_VM_RETURN_EXCEPTION: