Revert "Extract exception name via tp_name"

The implementation of __name__ is slightly more complex than that.
It handles the module name prefix, and heap-allocated types. We could
port it to pybind11 later on but for now it seems like an overkill.

This reverts commit f1435c7e6b.
This commit is contained in:
Sergei Lebedev 2019-08-28 18:53:35 +01:00
parent 60df1435dd
commit c935b73ba5

View File

@ -413,7 +413,7 @@ PYBIND11_NOINLINE inline std::string error_string(PyObject* type, PyObject* valu
// normalized by the caller? // normalized by the caller?
std::string errorString; std::string errorString;
if (type) { if (type) {
errorString += static_cast<const std::string>(reinterpret_cast<PyTypeObject*>(type)->tp_name); errorString += handle(type).attr("__name__").cast<std::string>();
errorString += ": "; errorString += ": ";
} }
if (value) if (value)