Do not attempt to normalize if no exception occurred

This is not supported on PyPy-2.7 5.8.0.
This commit is contained in:
Sergei Lebedev 2019-08-28 11:30:55 +01:00
parent 87d1f6ba08
commit e289e0ea24

View File

@ -335,6 +335,7 @@ public:
virtual const char* what() const noexcept { virtual const char* what() const noexcept {
if (m_lazy_what.empty()) { if (m_lazy_what.empty()) {
if (m_type || m_value || m_trace)
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr()); PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
m_lazy_what = detail::error_string(m_type.ptr(), m_value.ptr(), m_trace.ptr()); m_lazy_what = detail::error_string(m_type.ptr(), m_value.ptr(), m_trace.ptr());
} }