From 729e9cce7bd31d3f107a4d6e9498b0fa27119e22 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky <pfalcon@users.sourceforge.net> Date: Sat, 11 Jan 2014 21:12:15 +0200 Subject: [PATCH] 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. --- py/runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/runtime.c b/py/runtime.c index 409d1d826..b982ee32d 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -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)) { -- GitLab