summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-11 21:12:15 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-12 03:33:01 +0200
commit729e9cce7bd31d3f107a4d6e9498b0fa27119e22 (patch)
tree86e5c9ff4229e6c1d26ecc4450eced4efdba1bec /py
parentc698d266d1f13fe82a5ac291f7c6642da3dc0bdc (diff)
downloadmicropython-729e9cce7bd31d3f107a4d6e9498b0fa27119e22.tar.gz
micropython-729e9cce7bd31d3f107a4d6e9498b0fa27119e22.zip
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.
Diffstat (limited to 'py')
-rw-r--r--py/runtime.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 409d1d8262..b982ee32d0 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)) {