Add noexcept move and explicit fail throw

This commit is contained in:
Aaron Gokaslan 2022-02-22 11:10:10 -05:00
parent f8d3ed22bf
commit b90bd783f0

View File

@ -391,7 +391,7 @@ public:
} }
error_already_set(const error_already_set &) = default; error_already_set(const error_already_set &) = default;
error_already_set(error_already_set &&) = default; error_already_set(error_already_set &&) noexcept = default;
inline ~error_already_set() override; inline ~error_already_set() override;
@ -419,6 +419,9 @@ public:
/// error variables (but the `.what()` string is still available). /// error variables (but the `.what()` string is still available).
void restore() { void restore() {
what(); // Force-build `.what()`. what(); // Force-build `.what()`.
if (m_lazy_what.empty()) {
pybind11_fail("Critical error building lazy error_string().");
}
if (m_type) { if (m_type) {
PyErr_Restore( PyErr_Restore(
m_type.release().ptr(), m_value.release().ptr(), m_trace.release().ptr()); m_type.release().ptr(), m_value.release().ptr(), m_trace.release().ptr());