pyo3::err::err_state

Function raise_lazy

Source
fn raise_lazy(
    py: Python<'_>,
    lazy: Box<dyn for<'py> FnOnce(Python<'py>) -> PyErrStateLazyFnOutput + Send + Sync>,
)
Expand description

Raises a “lazy” exception state into the Python interpreter.

In principle this could be split in two; first a function to create an exception in a normalized state, and then a call to PyErr_SetRaisedException to raise it.

This would require either moving some logic from C to Rust, or requesting a new API in CPython.

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here