pybind11
pybind11 copied to clipboard
Expose exception cause as std::nested_exception
Description
Expose Python exception cause (raise ... from ...) to C++ via std::nested_exception. Inverse of #3608.
Useful after #3605 etc.
Does not set std::nested_exception base if a C++ exception is already present, for backwards compatibility if anyone is already using std::throw_with_nested(py::error_already_set()).
Suggested changelog entry:
`error_already_set` now inherits from `std::nested_exception` to expose the Python exception cause (`raise ... from ...`).