Skip to content

Commit d7150b0

Browse files
committed
py/runtime: Refactor default case of switch to remove assert(0).
1 parent 5bea080 commit d7150b0

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

py/runtime.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,9 @@ mp_obj_t mp_unary_op(mp_uint_t op, mp_obj_t arg) {
220220
} else {
221221
return MP_OBJ_NEW_SMALL_INT(-val);
222222
}
223-
case MP_UNARY_OP_INVERT:
224-
return MP_OBJ_NEW_SMALL_INT(~val);
225223
default:
226-
assert(0);
227-
return arg;
224+
assert(op == MP_UNARY_OP_INVERT);
225+
return MP_OBJ_NEW_SMALL_INT(~val);
228226
}
229227
} else if (op == MP_UNARY_OP_HASH && MP_OBJ_IS_STR_OR_BYTES(arg)) {
230228
// fast path for hashing str/bytes

0 commit comments

Comments
 (0)