File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -405,8 +405,9 @@ TEST_SUBMODULE(exceptions, m) {
405405 .def (py::init<const std::string &>())
406406 .def_readwrite (" a" , &CustomData::a);
407407
408- PYBIND11_CONSTINIT static py::gil_safe_call_once_and_store<py::object> storage;
409- storage.call_once_and_store_result ([&]() {
408+ PYBIND11_CONSTINIT static py::gil_safe_call_once_and_store<py::object>
409+ PythonMyException7_storage;
410+ PythonMyException7_storage.call_once_and_store_result ([&]() {
410411 auto mod = py::module_::import (" custom_exceptions" );
411412 py::object obj = mod.attr (" PythonMyException7" );
412413 return obj;
@@ -418,9 +419,9 @@ TEST_SUBMODULE(exceptions, m) {
418419 std::rethrow_exception (p);
419420 }
420421 } catch (const MyException7 &e) {
421- auto obj = storage .get_stored ();
422- py::object obj2 = obj (e.message );
423- PyErr_SetObject (PyExc_Exception, obj2 .ptr ());
422+ auto exc_type = PythonMyException7_storage .get_stored ();
423+ py::object exc_inst = exc_type (e.message );
424+ PyErr_SetObject (PyExc_Exception, exc_inst .ptr ());
424425 }
425426 });
426427}
You can’t perform that action at this time.
0 commit comments