Skip to content

Commit 9ed5e80

Browse files
committed
py/vm: Make "if" control flow more obvious in YIELD_FROM opcode.
1 parent 9d2c72a commit 9ed5e80

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

py/vm.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,7 @@ unwind_jump:;
11591159
ip--;
11601160
PUSH(ret_value);
11611161
goto yield;
1162-
}
1163-
if (ret_kind == MP_VM_RETURN_NORMAL) {
1162+
} else if (ret_kind == MP_VM_RETURN_NORMAL) {
11641163
// Pop exhausted gen
11651164
sp--;
11661165
// TODO: When ret_value can be MP_OBJ_NULL here??
@@ -1176,8 +1175,8 @@ unwind_jump:;
11761175
// if it was swallowed, we re-raise GeneratorExit
11771176
GENERATOR_EXIT_IF_NEEDED(t_exc);
11781177
DISPATCH();
1179-
}
1180-
if (ret_kind == MP_VM_RETURN_EXCEPTION) {
1178+
} else {
1179+
assert(ret_kind == MP_VM_RETURN_EXCEPTION);
11811180
// Pop exhausted gen
11821181
sp--;
11831182
if (EXC_MATCH(ret_value, MP_OBJ_FROM_PTR(&mp_type_StopIteration))) {

0 commit comments

Comments
 (0)