Skip to content

fix: update mp_obj_int_to_bytes implementation for correct byte conve… - #412

Closed
132xyz wants to merge 1 commit into
lvgl:masterfrom
132xyz:master
Closed

fix: update mp_obj_int_to_bytes implementation for correct byte conve…#412
132xyz wants to merge 1 commit into
lvgl:masterfrom
132xyz:master

Conversation

@132xyz

@132xyz 132xyz commented Jul 25, 2026

Copy link
Copy Markdown

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:
micropython/micropython@e00daa3

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).

Written for commit 7ee268e. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@132xyz 132xyz closed this Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant