mp_obj_new_int causing uncaught exception when value passed is greater than 30 bits

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
cduran
Posts: 47
Joined: Thu Mar 17, 2016 4:52 pm

mp_obj_new_int causing uncaught exception when value passed is greater than 30 bits

Post by cduran » Wed Oct 31, 2018 5:20 pm

Like the subject line says.

I'm using mp_obj_new_int to pass values between C and python. When I try to pass a number that is greater than 30 bits long I get an "uncaught exception".

Should I be using a different function for larger integers?

jickster
Posts: 532
Joined: Thu Sep 07, 2017 8:57 pm

Re: mp_obj_new_int causing uncaught exception when value passed is greater than 30 bits

Post by jickster » Wed Oct 31, 2018 5:38 pm

Paste the actual code for mp_obj_new_int that you’re using. If it can’t fit in a small int, it calls
mp_obj_t mp_obj_new_int_from_ll.


And when are you getting the exception?
Are you in an interrupt?


Sent from my iPhone using Tapatalk Pro

cduran
Posts: 47
Joined: Thu Mar 17, 2016 4:52 pm

Re: mp_obj_new_int causing uncaught exception when value passed is greater than 30 bits

Post by cduran » Thu Nov 01, 2018 4:26 pm

Fixed my problem.

Setting MICROPY_LONGINT_IMPL to MICROPY_LONGINT_IMPL_LONGLONG did the trick.

Post Reply