From 8fa66a6d2c268a2a41e938a435d7701969b762dc Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 29 May 2024 15:19:09 +0200 Subject: [PATCH] Update pybind11 to version 2.12.0 Currently used branch was not interoperable with a standard version of pybind11. --- .pre-commit-config.yaml | 2 +- core/python/bindings/src/core.cpp | 6 ++++-- core/python/pybind11 | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa133c80..cff5e8c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: - id: catkin_lint name: catkin_lint description: Check package.xml and cmake files - entry: catkin_lint . + entry: catkin_lint . --ignore duplicate_cmd language: system always_run: true pass_filenames: false diff --git a/core/python/bindings/src/core.cpp b/core/python/bindings/src/core.cpp index c1b48848..2d2dfa3f 100644 --- a/core/python/bindings/src/core.cpp +++ b/core/python/bindings/src/core.cpp @@ -80,7 +80,9 @@ void setForwardedProperties(Stage& self, const py::object& names) { void export_core(pybind11::module& m) { /// translate InitStageException into InitStageError - static py::exception init_stage_error(m, "InitStageError"); + PYBIND11_CONSTINIT static py::gil_safe_call_once_and_store exc_storage; + exc_storage.call_once_and_store_result([&]() { return py::exception(m, "InitStageError"); }); + /// provide extended error description for InitStageException py::register_exception_translator([](std::exception_ptr p) { // NOLINT(performance-unnecessary-value-param) try { @@ -89,7 +91,7 @@ void export_core(pybind11::module& m) { } catch (const InitStageException& e) { std::stringstream message; message << e; - init_stage_error(message.str().c_str()); + py::set_error(exc_storage.get_stored(), message.str().c_str()); } }); diff --git a/core/python/pybind11 b/core/python/pybind11 index 4070a64f..f4bc71f9 160000 --- a/core/python/pybind11 +++ b/core/python/pybind11 @@ -1 +1 @@ -Subproject commit 4070a64f867c60842476f74a2212110ea5e05230 +Subproject commit f4bc71f981d4eb2dd780215fd3c5a7420f1f03aa