don't set nested exception if already set

This commit is contained in:
Ed Catmur 2022-06-28 15:50:28 +01:00
parent 1bd0eaae06
commit a8046ffe2d

View File

@ -581,6 +581,7 @@ public:
error_already_set() error_already_set()
: m_fetched_error{new detail::error_fetch_and_normalize("pybind11::error_already_set"), : m_fetched_error{new detail::error_fetch_and_normalize("pybind11::error_already_set"),
m_fetched_error_deleter} { m_fetched_error_deleter} {
if (not nested_ptr())
static_cast<std::nested_exception&>(*this) = m_fetched_error->get_cause_as_nested(); static_cast<std::nested_exception&>(*this) = m_fetched_error->get_cause_as_nested();
} }