Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
8bcb9861
Commit
8bcb9861
authored
Apr 17, 2014
by
Damien George
Browse files
py: Don't assert but go to unsupported_op in mp_binary_op for small int.
parent
5cd0b222
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/runtime.c
View file @
8bcb9861
...
...
@@ -365,7 +365,8 @@ mp_obj_t mp_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
case
MP_BINARY_OP_LESS_EQUAL
:
return
MP_BOOL
(
lhs_val
<=
rhs_val
);
break
;
case
MP_BINARY_OP_MORE_EQUAL
:
return
MP_BOOL
(
lhs_val
>=
rhs_val
);
break
;
default:
assert
(
0
);
default:
goto
unsupported_op
;
}
// TODO: We just should make mp_obj_new_int() inline and use that
if
(
MP_OBJ_FITS_SMALL_INT
(
lhs_val
))
{
...
...
@@ -437,9 +438,7 @@ generic_binary_op:
// TODO implement dispatch for reverse binary ops
// TODO specify in error message what the operator is
#if MICROPY_ENABLE_FLOAT
unsupported_op:
#endif
nlr_raise
(
mp_obj_new_exception_msg_varg
(
&
mp_type_TypeError
,
"unsupported operand types for binary operator: '%s', '%s'"
,
mp_obj_get_type_str
(
lhs
),
mp_obj_get_type_str
(
rhs
)));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment