We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 87d1f6b commit e289e0eCopy full SHA for e289e0e
include/pybind11/pytypes.h
@@ -335,7 +335,8 @@ class error_already_set : public std::exception {
335
336
virtual const char* what() const noexcept {
337
if (m_lazy_what.empty()) {
338
- PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
+ if (m_type || m_value || m_trace)
339
+ PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
340
m_lazy_what = detail::error_string(m_type.ptr(), m_value.ptr(), m_trace.ptr());
341
}
342
return m_lazy_what.c_str();
0 commit comments