Skip to content

fix(ntcore): register bool put/set overloads before double - #324

Closed
Amidwestnoob wants to merge 1 commit into
robotpy:mainfrom
Amidwestnoob:fix/318-ntcore-bool-overload-order
Closed

Amidwestnoob wants to merge 1 commit into
robotpy:mainfrom
Amidwestnoob:fix/318-ntcore-bool-overload-order

Conversation

@Amidwestnoob

Copy link
Copy Markdown

Summary

  • Under pybind11 3.1, Python bool can bind the earlier double overload because bool subclasses int.
  • Register the bool overload first, with .noconvert() on the value, for:
    • NetworkTable.put_value / set_default_value
    • NetworkTableEntry.set_value / set_default_value
  • Existing test_getvalue_overloads covers put_value("boolean", True).

Closes #318

Test plan

  • CI: pyntcore / ntcore tests including tests/test_network_table.py::test_getvalue_overloads
  • Confirm put_value(..., True) stores a boolean, while numeric 1 / 1.0 still store doubles

Under pybind11 3.1, Python bool subclasses int and can bind the
double overload when it is registered first. Put bool first with
noconvert so True/False stay boolean NT values.

Closes robotpy#318
@virtuald

Copy link
Copy Markdown
Member

If you're going to use a clanker, at least add tests.

@virtuald virtuald closed this Sep 12, 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.

Fix ntcore overloads during pybind11 upgrade

2 participants