diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index b2f5890fa..e3a6ecbd4 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -475,7 +475,7 @@ PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyOb return "Unknown internal error occurred"; } - std::string result = handle(type).attr("__name__").cast(); + auto result = handle(type).attr("__name__").cast(); result += ": "; if (value) {