Skip to content

Commit e289e0e

Browse files
committed
Do not attempt to normalize if no exception occurred
This is not supported on PyPy-2.7 5.8.0.
1 parent 87d1f6b commit e289e0e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/pybind11/pytypes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ class error_already_set : public std::exception {
335335

336336
virtual const char* what() const noexcept {
337337
if (m_lazy_what.empty()) {
338-
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
338+
if (m_type || m_value || m_trace)
339+
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
339340
m_lazy_what = detail::error_string(m_type.ptr(), m_value.ptr(), m_trace.ptr());
340341
}
341342
return m_lazy_what.c_str();

0 commit comments

Comments
 (0)