summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-02-27 15:48:09 +1100
committerDamien George <damien.p.george@gmail.com>2018-02-27 15:48:09 +1100
commita9f6d4921829195d7310aa8b07a4a705577161a5 (patch)
treebece9422d8668c9b3a22a0d256925da79d1836fe /py/runtime.c
parent22ade2f5c4ac88c90a013cbf4b81c8d795487f33 (diff)
py/vm: Simplify handling of special-case STOP_ITERATION in yield from.
There's no need to have MP_OBJ_NULL a special case, the code can re-use the MP_OBJ_STOP_ITERATION value to signal the special case and the VM can detect this with only one check (for MP_OBJ_STOP_ITERATION).
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 65d0df639..54ec0d70b 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1215,13 +1215,12 @@ mp_vm_return_kind_t mp_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t th
if (type->iternext != NULL && send_value == mp_const_none) {
mp_obj_t ret = type->iternext(self_in);
+ *ret_val = ret;
if (ret != MP_OBJ_STOP_ITERATION) {
- *ret_val = ret;
return MP_VM_RETURN_YIELD;
} else {
// Emulate raise StopIteration()
// Special case, handled in vm.c
- *ret_val = MP_OBJ_NULL;
return MP_VM_RETURN_NORMAL;
}
}