|
|
Simply replace the files in the ``pybind11`` and ``dune/pybindxi`` folders with the updated ones from the [pybind11 repo](https://github.com/pybind/pybind11) and apply ``clang-format``.
|
|
|
|
|
|
If https://github.com/pybind/pybind11/pull/2573 is already contained in the new version, you are done. Otherwise, to fix compilation with the Intel Compiler, make sure to reapply the following patch.
|
|
|
Check if the `dune/pybindxi/disable_pybindxi_warnings.sh` script needs to be updated and then execute the script. Also check if new header files have to be added to the list in `dune/pybindxi/CMakeLists.txt`.
|
|
|
|
|
|
Output of ``git diff dune/pybindxi/cast.h``:
|
|
|
```diff
|
|
|
-/// Collect only positional arguments for a Python function call
|
|
|
-template <return_value_policy policy, typename... Args, typename = enable_if_t<all_of<is_positional<Args>...>::value>>
|
|
|
-simple_collector<policy> collect_arguments(Args&&... args)
|
|
|
-{
|
|
|
- return simple_collector<policy>(std::forward<Args>(args)...);
|
|
|
-}
|
|
|
-
|
|
|
-/// Collect all arguments, including keywords and unpacking (only instantiated when needed)
|
|
|
-template <return_value_policy policy, typename... Args, typename = enable_if_t<!all_of<is_positional<Args>...>::value>>
|
|
|
-unpacking_collector<policy> collect_arguments(Args&&... args)
|
|
|
+template <return_value_policy policy, typename... Args>
|
|
|
+auto collect_arguments(Args&&... args)
|
|
|
{
|
|
|
- // Following argument order rules for generalized unpacking according to PEP 448
|
|
|
- static_assert(constexpr_last<is_positional, Args...>() < constexpr_first<is_keyword_or_ds, Args...>()
|
|
|
- && constexpr_last<is_s_unpacking, Args...>() < constexpr_first<is_ds_unpacking, Args...>(),
|
|
|
- "Invalid function call: positional args must precede keywords and ** unpacking; "
|
|
|
- "* unpacking must precede ** unpacking");
|
|
|
- return unpacking_collector<policy>(std::forward<Args>(args)...);
|
|
|
+ if constexpr (all_of<is_positional<Args>...>::value) {
|
|
|
+ return simple_collector<policy>(std::forward<Args>(args)...);
|
|
|
+ } else {
|
|
|
+ static_assert(constexpr_last<is_positional, Args...>() < constexpr_first<is_keyword_or_ds, Args...>()
|
|
|
+ && constexpr_last<is_s_unpacking, Args...>() < constexpr_first<is_ds_unpacking, Args...>(),
|
|
|
+ "Invalid function call: positional args must precede keywords and ** unpacking; "
|
|
|
+ "* unpacking must precede ** unpacking");
|
|
|
+ return unpacking_collector<policy>(std::forward<Args>(args)...);
|
|
|
+ }
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
Check if everything still works, in particular compiling the bindings (run `make bindings` or `ninja bindings` in the build directory) and the python tests (`make test_python` or `ninja test_python`). If errors occur, you may have to update the modified copy of ``pybind11_add_module`` in `cmake/modules/DunePybindxiUtils.cmake` or the copy of `dune_python_install_package` in `cmake/modules/DunePybindxiInstallPythonPackage.cmake`. |
|
|
\ No newline at end of file |