Skip to content

Commit c3b3f20

Browse files
cuiweixiedpgeorge
authored andcommitted
py/objint: Fix comment for true operand in binary op extra cases.
The comment incorrectly said true acts as 0; the implementation passes small int 1, matching Python bool semantics. Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
1 parent 47fc0d5 commit c3b3f20

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

py/objint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(mp_binary_op_t op, mp_obj_t lhs_in, mp
383383
// false acts as 0
384384
return mp_binary_op(op, lhs_in, MP_OBJ_NEW_SMALL_INT(0));
385385
} else if (rhs_in == mp_const_true) {
386-
// true acts as 0
386+
// true acts as 1
387387
return mp_binary_op(op, lhs_in, MP_OBJ_NEW_SMALL_INT(1));
388388
} else if (op == MP_BINARY_OP_MULTIPLY) {
389389
if (mp_obj_is_str_or_bytes(rhs_in) || mp_obj_is_type(rhs_in, &mp_type_tuple) || mp_obj_is_type(rhs_in, &mp_type_list)) {

0 commit comments

Comments
 (0)