fix: update mp_obj_int_to_bytes implementation for correct byte conve…

Closed
13
3mo ago
+2-2

MicroPython commit e00daa3a5 replaced the internal
mp_obj_int_to_bytes_impl() API with mp_obj_int_to_bytes().

The binding generator still emits a call to the removed API, which causes
generated lv_mp.c files to fail compilation against the current MicroPython
master branch:

error: implicit declaration of function 'mp_obj_int_to_bytes_impl'

This PR updates mp_obj_get_ull() to use the new API:

mp_obj_int_to_bytes(
    obj,
    sizeof(val),
    (byte *)&val,
    big_endian,
    false,
    false
);

The last two arguments keep the conversion unsigned and preserve the previous
non-overflow-checking/truncation behavior. This is consistent with the migration
of the equivalent unsigned long long conversion in MicroPython's modffi.c.
MicroPython change:
https://github.com/micropython/micropython/commit/e00daa3a507857d25295ebf322e9c20cf5c5df16

Testing

Generated lv_mp.c with the updated binding generator.
Built the ESP32-S3 port against the current MicroPython master.
Confirmed that lv_mp.c no longer references
mp_obj_int_to_bytes_impl().


Summary by cubic

Switches the binding generator and example to mp_obj_int_to_bytes() to match current MicroPython and fix build errors from the removed mp_obj_int_to_bytes_impl(). Keeps unsigned, truncating behavior and correct endianness; generated bindings compile again (tested on ESP32-S3).