Skip to content

Upgrade pybind11 to the latest 2.x version #27

@pelesh

Description

@pelesh

Issue type

Feature Request

Issue applies to:

  • PFLOW
  • OPFLOW
  • TCOPFLOW
  • SCOPFLOW
  • SOPFLOW
  • CMake and build system
  • Spack
  • Visualization
  • Documentation
  • Other

Summary

Update python bindings submodule pybind11 to the latest 2.x version, currently 2.13.6. Currently we get some deprecation warnings during pybind11 configuration and compilation. Currently used version in ExaGO is 3 years old so updating to the latest stable will likely address some of the warnings.

Description how to reproduce the issue

Example warnings coming from pybind11:

Details
In lambda function,
    inlined from 'Return pybind11::detail::argument_loader<Args>::call_impl(Func&&, std::index_sequence<Is ...>, Guard&&) && [with Return = int; Func = test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&; long unsigned int ...Is = {0}; Guard = pybind11::detail::void_type; Args = {std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >}]' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1504:37,
    inlined from 'std::enable_if_t<(! std::is_void<_Dummy>::value), Return> pybind11::detail::argument_loader<Args>::call(Func&&) && [with Return = int; Guard = pybind11::detail::void_type; Func = test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&; Args = {std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >}]' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1472:72,
    inlined from 'pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:294:40,
    inlined from 'static constexpr pybind11::handle pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>::_FUN(pybind11::detail::function_call&)' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:265:21:
/Users/55y/src/exago/ExaGO/tpl/pybind11/tests/test_copy_move.cpp:233:38: warning: '((__tuple_element_t<0, std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >*)((char*)&<unnamed> + offsetof(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >,std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >::<unnamed>.std::_Optional_base<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, false, false>::_M_payload.std::_Optional_payload<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, false, false, false>::<unnamed>.std::_Optional_payload<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, true, false, false>::<unnamed>.std::_Optional_payload_base<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >::_M_payload)))[2].MoveOrCopyInt::value' may be used uninitialized [-Wmaybe-uninitialized]
  233 |               return std::get<0>(*x).value + std::get<1>(*x).value + std::get<2>(*x).value;
      |                      ~~~~~~~~~~~~~~~~^~~~~
In file included from /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/attr.h:14,
                 from /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/detail/class.h:12,
                 from /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:13,
                 from /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/stl.h:12,
                 from /Users/55y/src/exago/ExaGO/tpl/pybind11/tests/test_copy_move.cpp:11:
/Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h: In static member function 'static constexpr pybind11::handle pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>::_FUN(pybind11::detail::function_call&)':
/Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1504:37: note: '<anonymous>' declared here
 1504 |         return std::forward<Func>(f)(cast_op<Args>(std::move(std::get<Is>(argcasters)))...);
      |                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In lambda function,
    inlined from 'Return pybind11::detail::argument_loader<Args>::call_impl(Func&&, std::index_sequence<Is ...>, Guard&&) && [with Return = int; Func = test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&; long unsigned int ...Is = {0}; Guard = pybind11::detail::void_type; Args = {std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >}]' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1504:37,
    inlined from 'std::enable_if_t<(! std::is_void<_Dummy>::value), Return> pybind11::detail::argument_loader<Args>::call(Func&&) && [with Return = int; Guard = pybind11::detail::void_type; Func = test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&; Args = {std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >}]' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1472:72,
    inlined from 'pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:294:40,
    inlined from 'static constexpr pybind11::handle pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>::_FUN(pybind11::detail::function_call&)' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:265:21:
/Users/55y/src/exago/ExaGO/tpl/pybind11/tests/test_copy_move.cpp:233:62: warning: '((__tuple_element_t<1, std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >*)((char*)&<unnamed> + offsetof(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >,std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >::<unnamed>.std::_Optional_base<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, false, false>::_M_payload.std::_Optional_payload<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, false, false, false>::<unnamed>.std::_Optional_payload<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, true, false, false>::<unnamed>.std::_Optional_payload_base<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >::_M_payload)))[1].MoveOnlyInt::value' may be used uninitialized [-Wmaybe-uninitialized]
  233 |               return std::get<0>(*x).value + std::get<1>(*x).value + std::get<2>(*x).value;
      |                                              ~~~~~~~~~~~~~~~~^~~~~
/Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h: In static member function 'static constexpr pybind11::handle pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>::_FUN(pybind11::detail::function_call&)':
/Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1504:37: note: '<anonymous>' declared here
 1504 |         return std::forward<Func>(f)(cast_op<Args>(std::move(std::get<Is>(argcasters)))...);
      |                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In lambda function,
    inlined from 'Return pybind11::detail::argument_loader<Args>::call_impl(Func&&, std::index_sequence<Is ...>, Guard&&) && [with Return = int; Func = test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&; long unsigned int ...Is = {0}; Guard = pybind11::detail::void_type; Args = {std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >}]' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1504:37,
    inlined from 'std::enable_if_t<(! std::is_void<_Dummy>::value), Return> pybind11::detail::argument_loader<Args>::call(Func&&) && [with Return = int; Guard = pybind11::detail::void_type; Func = test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&; Args = {std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >}]' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1472:72,
    inlined from 'pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:294:40,
    inlined from 'static constexpr pybind11::handle pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>::_FUN(pybind11::detail::function_call&)' at /Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/pybind11.h:265:21:
/Users/55y/src/exago/ExaGO/tpl/pybind11/tests/test_copy_move.cpp:233:86: warning: '*(__tuple_element_t<2, std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >*)((char*)&<unnamed> + offsetof(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >,std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >::<unnamed>.std::_Optional_base<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>, false, false>::<unnamed>)).CopyOnlyInt::value' may be used uninitialized [-Wmaybe-uninitialized]
  233 |               return std::get<0>(*x).value + std::get<1>(*x).value + std::get<2>(*x).value;
      |                                                                      ~~~~~~~~~~~~~~~~^~~~~
/Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h: In static member function 'static constexpr pybind11::handle pybind11::cpp_function::initialize<test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>, int, std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >, pybind11::name, pybind11::scope, pybind11::sibling>(test_submodule_copy_move_policies(pybind11::module_&)::<lambda(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >)>&&, int (*)(std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt> >), const pybind11::name&, const pybind11::scope&, const pybind11::sibling&)::<lambda(pybind11::detail::function_call&)>::_FUN(pybind11::detail::function_call&)':
/Users/55y/src/exago/ExaGO/tpl/pybind11/include/pybind11/cast.h:1504:37: note: '<anonymous>' declared here
 1504 |         return std::forward<Func>(f)(cast_op<Args>(std::move(std::get<Is>(argcasters)))...);
      |                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ExaGO version

develop at 69f5b0e

System and environment details

MacOS 15.7.5, Python 3.13.3, GCC 13.4.0.

Additional information

No response

Proposed solution

Set pybind11 git submodule to v2.13.6 tag. Make sure the code builds cleanly and all tests pass.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions