Creates a new PyErr of type `T`. `value` can be: `NoArgs`: the exception instance will be created using python `T()` a tuple: the exception instance will be created using python `T(*tuple)` any other value: the exception instance will be created using python `T(value)` Panics if `T` is not a python class derived from `BaseException`. Example: `return Err(PyErr::new:: (py, "Err
(py: Python, value: V)
| 170 | /// Example: |
| 171 | /// `return Err(PyErr::new::<exc::TypeError, _>(py, "Error message"));` |
| 172 | pub fn new<T, V>(py: Python, value: V) -> PyErr |
| 173 | where |
| 174 | T: PythonObjectWithTypeObject, |
| 175 | V: ToPyObject, |
| 176 | { |
| 177 | PyErr::new_helper(py, py.get_type::<T>(), value.to_py_object(py).into_object()) |
| 178 | } |
| 179 | |
| 180 | /// Gets whether an error is present in the Python interpreter's global state. |
| 181 | #[inline] |
nothing calls this directly
no test coverage detected