mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-03 18:37:12 +00:00
Moved normalization to error_already_set ctor
This commit is contained in:
parent
115a757a5d
commit
db14dd902e
@ -326,6 +326,8 @@ public:
|
|||||||
/// Python error indicator will be cleared.
|
/// Python error indicator will be cleared.
|
||||||
error_already_set() : std::runtime_error("") {
|
error_already_set() : std::runtime_error("") {
|
||||||
PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||||
|
if (m_type)
|
||||||
|
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
error_already_set(const error_already_set &) = default;
|
error_already_set(const error_already_set &) = default;
|
||||||
@ -335,9 +337,6 @@ 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()) {
|
||||||
if (m_type)
|
|
||||||
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
|
||||||
|
|
||||||
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 (...) {
|
} catch (...) {
|
||||||
|
Loading…
Reference in New Issue
Block a user