File tree 1 file changed +6
-5
lines changed
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) {
405
405
.def (py::init<const std::string &>())
406
406
.def_readwrite (" a" , &CustomData::a);
407
407
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 ([&]() {
410
411
auto mod = py::module_::import (" custom_exceptions" );
411
412
py::object obj = mod.attr (" PythonMyException7" );
412
413
return obj;
@@ -418,9 +419,9 @@ TEST_SUBMODULE(exceptions, m) {
418
419
std::rethrow_exception (p);
419
420
}
420
421
} 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 ());
424
425
}
425
426
});
426
427
}
You can’t perform that action at this time.
0 commit comments