mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-23 17:09:27 +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 += ": ";
|
result += ": ";
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
result += str(value).cast<std::string>();
|
result += (std::string) str(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trace) {
|
if (trace) {
|
||||||
@ -517,6 +517,9 @@ PYBIND11_NOINLINE std::string error_string() {
|
|||||||
error_scope scope; // Preserve error state.
|
error_scope scope; // Preserve error state.
|
||||||
if (scope.type) {
|
if (scope.type) {
|
||||||
PyErr_NormalizeException(&scope.type, &scope.value, &scope.trace);
|
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);
|
return error_string(scope.type, scope.value, scope.trace);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "detail/common.h"
|
#include "detail/common.h"
|
||||||
#include "buffer_info.h"
|
#include "buffer_info.h"
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -397,9 +398,15 @@ public:
|
|||||||
inline ~error_already_set() override;
|
inline ~error_already_set() override;
|
||||||
|
|
||||||
const char *what() const noexcept override {
|
const char *what() const noexcept override {
|
||||||
if (m_lazy_what.empty() && m_type) {
|
if (m_lazy_what.empty()) {
|
||||||
try {
|
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 (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 (...) {
|
} catch (...) {
|
||||||
m_lazy_what = "Unknown internal error occurred";
|
m_lazy_what = "Unknown internal error occurred";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user