Skip to content

bindParameter: use mp_obj_is_float() so it builds on MicroPython 1.29+#39

Open
UKTailwind wants to merge 1 commit into
spatialdude:mainfrom
UKTailwind:fix-float-1.29
Open

bindParameter: use mp_obj_is_float() so it builds on MicroPython 1.29+#39
UKTailwind wants to merge 1 commit into
spatialdude:mainfrom
UKTailwind:fix-float-1.29

Conversation

@UKTailwind

Copy link
Copy Markdown

bindParameter() uses mp_obj_is_type(value, &mp_type_float) to detect floats. On MicroPython 1.29+ that trips a compile-time static assert (mp_type_assert_not_float): float can be a value-encoded type, so there is no mp_type_float object to compare a pointer against. The build fails.

Use the portable mp_obj_is_float(value) instead — one line, correct on both value-encoded and object floats, and equivalent on earlier versions.

Builds cleanly on MicroPython 1.29+ (verified on the rp2 and unix ports).

mp_obj_is_type(v, &mp_type_float) now trips a compile-time static assert
(mp_type_assert_not_float) in MicroPython 1.29, since float may be a
value-encoded type. Use mp_obj_is_float() instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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