summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/objint_longlong.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index bceee095af..ea19b6804e 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -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;