Commit 50f56227 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py/objint_longlong: Instead of assert, throw OverflowError.

parent c27e5c4b
......@@ -231,7 +231,9 @@ mp_obj_t mp_obj_new_int_from_ll(long long val) {
mp_obj_t mp_obj_new_int_from_ull(unsigned long long val) {
// TODO raise an exception if the unsigned long long won't fit
assert(val >> (sizeof(unsigned long long) * 8 - 1) == 0);
if (val >> (sizeof(unsigned long long) * 8 - 1) != 0) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OverflowError, "ulonglong too large"));
}
mp_obj_int_t *o = m_new_obj(mp_obj_int_t);
o->base.type = &mp_type_int;
o->val = val;
......
Supports Markdown
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