Fixed PyPy build

This commit is contained in:
Sergei Lebedev 2019-08-29 14:56:36 +01:00
parent b48bc720e0
commit 115a757a5d
2 changed files with 5 additions and 3 deletions

View File

@ -415,8 +415,8 @@ PYBIND11_NOINLINE inline std::string error_string(PyObject *type, PyObject *valu
if (value) if (value)
result += str(value).cast<std::string>(); result += str(value).cast<std::string>();
#if !defined(PYPY_VERSION)
if (trace) { if (trace) {
#if !defined(PYPY_VERSION)
PyTracebackObject *tb = (PyTracebackObject *) trace; PyTracebackObject *tb = (PyTracebackObject *) trace;
// Get the deepest trace possible. // Get the deepest trace possible.
@ -433,8 +433,8 @@ PYBIND11_NOINLINE inline std::string error_string(PyObject *type, PyObject *valu
handle(frame->f_code->co_name).cast<std::string>() + "\n"; handle(frame->f_code->co_name).cast<std::string>() + "\n";
frame = frame->f_back; frame = frame->f_back;
} }
}
#endif #endif
}
return result; return result;
} }

View File

@ -335,8 +335,10 @@ public:
virtual const char* what() const noexcept override { virtual const char* what() const noexcept override {
if (m_lazy_what.empty()) { if (m_lazy_what.empty()) {
try { if (m_type)
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr()); PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
try {
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());
} catch (...) { } catch (...) {
return "Unknown internal error occurred"; return "Unknown internal error occurred";