mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-28 13:52:46 +00:00
Change error_already_set() to call pybind11_fail() if the Python error indicator not set. The net result is that a std::runtime_error is thrown instead of error_already_set, but all tests pass as is.
This commit is contained in:
parent
dded0243a4
commit
4193375ed6
@ -391,9 +391,8 @@ public:
|
||||
/// RuntimeError("Internal error: ..."). The current Python error indicator will be cleared.
|
||||
error_already_set() : std::runtime_error("") {
|
||||
if (!PyErr_Occurred()) {
|
||||
m_lazy_what = "Internal error: pybind11::detail::error_already_set called while "
|
||||
"Python error indicator not set.";
|
||||
PyErr_SetString(PyExc_RuntimeError, m_lazy_what.c_str());
|
||||
pybind11_fail("Internal error: pybind11::detail::error_already_set called while "
|
||||
"Python error indicator not set.");
|
||||
}
|
||||
PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||
PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
|
||||
|
Loading…
Reference in New Issue
Block a user