summaryrefslogtreecommitdiff
path: root/py/vm.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/vm.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/vm.c')
-rw-r--r--py/vm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/py/vm.c b/py/vm.c
index 416de6b1a..2a8e3c990 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -1178,8 +1178,7 @@ yield:
} else if (ret_kind == MP_VM_RETURN_NORMAL) {
// Pop exhausted gen
sp--;
- // TODO: When ret_value can be MP_OBJ_NULL here??
- if (ret_value == MP_OBJ_NULL || ret_value == MP_OBJ_STOP_ITERATION) {
+ if (ret_value == MP_OBJ_STOP_ITERATION) {
// Optimize StopIteration
// TODO: get StopIteration's value
PUSH(mp_const_none);