diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index ae8994945..01772f969 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -478,9 +478,9 @@ error_string(PyObject *exc_type, PyObject *exc_value, PyObject *exc_trace) { } // Normalize the exception only locally (to avoid side-effects for our caller). - object exc_type_loc = reinterpret_borrow(exc_type); - object exc_value_loc = reinterpret_borrow(exc_value); - object exc_trace_loc = reinterpret_borrow(exc_trace); + auto exc_type_loc = reinterpret_borrow(exc_type); + auto exc_value_loc = reinterpret_borrow(exc_value); + auto exc_trace_loc = reinterpret_borrow(exc_trace); PyErr_NormalizeException(&exc_type_loc.ptr(), &exc_value_loc.ptr(), &exc_trace_loc.ptr()); auto result = exc_type_loc.attr("__name__").cast();