diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 8bcf81761..c02708195 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -413,7 +413,7 @@ PYBIND11_NOINLINE inline std::string error_string(PyObject* type, PyObject* valu // normalized by the caller? std::string errorString; if (type) { - errorString += handle(type).attr("__name__").cast(); + errorString += static_cast(reinterpret_cast(type)->tp_name); errorString += ": "; } if (value)