Creates a new PyErr. `obj` must be an Python exception instance, the PyErr will use that instance. If `obj` is a Python exception type object, the PyErr will (lazily) create a new instance of that type. Otherwise, a `TypeError` is created instead.
(py: Python, obj: O)
| 259 | /// If `obj` is a Python exception type object, the PyErr will (lazily) create a new instance of that type. |
| 260 | /// Otherwise, a `TypeError` is created instead. |
| 261 | pub fn from_instance<O>(py: Python, obj: O) -> PyErr |
| 262 | where |
| 263 | O: PythonObject, |
| 264 | { |
| 265 | PyErr::from_instance_helper(py, obj.into_object()) |
| 266 | } |
| 267 | |
| 268 | fn from_instance_helper(py: Python, obj: PyObject) -> PyErr { |
| 269 | if unsafe { ffi::PyExceptionInstance_Check(obj.as_ptr()) } != 0 { |
nothing calls this directly
no test coverage detected