rt_binary_op(): Don't fall thru in case small_int op result doesn't fit back.

Currently it would report "operation not supported" which is confusing. Overall,
this is thinko leading to undefined behavior.
genexit-inst
Paul Sokolovsky 2014-01-11 21:12:15 +02:00
parent c698d266d1
commit 729e9cce7b
1 changed files with 2 additions and 0 deletions

View File

@ -553,6 +553,8 @@ mp_obj_t rt_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
if (fit_small_int(lhs_val)) {
return MP_OBJ_NEW_SMALL_INT(lhs_val);
}
// TODO: return long int
assert(0);
} else if (MP_OBJ_IS_TYPE(rhs, &float_type)) {
return mp_obj_float_binary_op(op, lhs_val, rhs);
} else if (MP_OBJ_IS_TYPE(rhs, &complex_type)) {