Commit 729e9cce authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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.
parent c698d266
......@@ -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)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment