mirror of
https://github.com/micropython/micropython.git
synced 2025-09-03 08:20:28 +02:00
py/objint_longlong: Instead of assert, throw OverflowError.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user