Repository navigation
Stub struct methods use the runtime names; CPython binds anonymous struct and union fields - #47
Merged
Merged
Conversation
…mous struct and union fields The stub named struct methods with their struct's prefix (grad_dsc_t.grad_linear_init), but both runtimes bind them without it (linear_init). The stub now names them the way the runtimes do. CPython skipped fields whose type is an anonymous struct or union, so grad_dsc_t.params was missing. It now typedefs them the way MicroPython does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39. #45 has merged, so this is based on main.
The stub named struct methods with their struct's prefix, as in
grad_dsc_t.grad_linear_init. Both runtimes bind them without it, as inlinear_init. The stub now uses the runtime names. This renames about 75 stub methods, among themcache_t.create,draw_buf_t.align_exand thegrad_dsc_thelpers.CPython also skipped fields whose type is an anonymous struct or union, so
grad_dsc_t.paramsdidn't exist there. It now binds them the way MicroPython does, as nested types such asparams.linear,params.radialandparams.conical, which you can read and write.New tests, each failing before this change:
test_struct_method_names_match_the_runtime_bindingfailed withassert 'grad_linear_init' == 'linear_init'.test_generated_struct_method_names_match_the_runtime_bindingchecks every struct method inapi.jsonagainst the runtime's naming rule. It failed with a list of mismatches.test_grad_helperscallslinear_init,radial_initandconical_init, then reads and writesparams. On CPython it failed with'lvgl.lv_grad_dsc_t' object has no attribute 'params'.With this change, the smoke test passes on MicroPython and CPython locally, and so do lvgl-python's unittests. pytest (109) passes and
regenerate_all.sh --checkmatches.Some stub methods that take their struct by value are still missing on CPython. That's #46.