Open
Description
Port, board and/or hardware
ESP32
MicroPython version
MicroPython v1.24.1 on 2024-11-29; Generic ESP32 module with ESP32
Reproduction
>>> from time import gmtime
>>> gmtime(2147483647) # max size of 32 bit int
(2068, 1, 19, 3, 14, 7, 3, 19)
>>> gmtime(2147483648) # max size of 32 bit int + 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: overflow converting long int to machine word
Expected behaviour
>>> from time import gmtime
>>> gmtime(2147483647) # max size of 32 bit int
(2068, 1, 19, 3, 14, 7, 3, 19)
>>> gmtime(2147483648) # max size of 32 bit int + 1
(2068, 1, 19, 3, 14, 8, 3, 19)
Observed behaviour
>>> from time import gmtime
>>> gmtime(2147483647) # max size of 32 bit int
(2068, 1, 19, 3, 14, 7, 3, 19)
>>> gmtime(2147483648) # max size of 32 bit int + 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: overflow converting long int to machine word
Additional Information
I see two solutions
Preferred
update the code to work with 64 bit ints
Alternative
update the documentation to include this limited behaviour
Code of Conduct
Yes, I agree