mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-23 08:59:43 +00:00
Try to debug PGI
This commit is contained in:
parent
63dfbb436e
commit
d231f15996
@ -479,7 +479,7 @@ PYBIND11_NOINLINE std::string error_string(PyObject *type, PyObject *value, PyOb
|
||||
result += ": ";
|
||||
|
||||
if (value) {
|
||||
result += str(value).cast<std::string>();
|
||||
result += (std::string) str(value);
|
||||
}
|
||||
|
||||
if (trace) {
|
||||
@ -517,6 +517,9 @@ PYBIND11_NOINLINE std::string error_string() {
|
||||
error_scope scope; // Preserve error state.
|
||||
if (scope.type) {
|
||||
PyErr_NormalizeException(&scope.type, &scope.value, &scope.trace);
|
||||
/*if (scope.trace != nullptr){
|
||||
PyErr_SetTraceback(scope.value, scope.trace);
|
||||
}*/
|
||||
}
|
||||
return error_string(scope.type, scope.value, scope.trace);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "detail/common.h"
|
||||
#include "buffer_info.h"
|
||||
|
||||
#include <exception>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
@ -397,9 +398,15 @@ public:
|
||||
inline ~error_already_set() override;
|
||||
|
||||
const char *what() const noexcept override {
|
||||
if (m_lazy_what.empty() && m_type) {
|
||||
if (m_lazy_what.empty()) {
|
||||
try {
|
||||
m_lazy_what = detail::error_string(m_type.ptr(), m_value.ptr(), m_trace.ptr());
|
||||
} catch (const std::exception &e) {
|
||||
m_lazy_what
|
||||
= std::string(
|
||||
"Unknown internal error occurred while constructing error_string:")
|
||||
+ e.what();
|
||||
return m_lazy_what.c_str();
|
||||
} catch (...) {
|
||||
m_lazy_what = "Unknown internal error occurred";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user