Skip to content

Fix ntcore overloads during pybind11 upgrade #318

Description

@virtuald

From 🤖 :

Confirmed: the failure is caused by pybind11 3.1’s change in PR #5879.

  • Reproduced: 1 failed, 58 passed, 1 xfailed.
  • test_getvalue_overloads fails because put_value("boolean", True) stores double 1.0, not boolean True.

Root cause: These bindings register the double overload before bool. Previously, pybind11 rejected booleans for double during its first, no-conversion overload pass.
Version 3.1 accepts Python integers in that pass—and Python booleans are integer subclasses. Consequently, the earlier double overload wins.

Confirmed affected methods:

  • NetworkTable.put_value
  • NetworkTable.set_default_value
  • NetworkTableEntry.set_value
  • NetworkTableEntry.set_default_value

Their overloads are in:

  • subprojects/pyntcore/ntcore/src/NetworkTable.cpp.inl
  • subprojects/pyntcore/ntcore/src/NetworkTableEntry.cpp.inl

Recommended fix: Register bool first, with .noconvert() on its value argument, followed by double. This prioritizes actual booleans without allowing the boolean overload to
absorb other numeric inputs. Adding .noconvert() to double alone won’t help under the new semantics


There probably are other places (datalog?) that this may affect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions