(py: Python, obj: &PyObject)
| 49 | |
| 50 | impl FromPyObject<'_> for PyNone { |
| 51 | fn extract(py: Python, obj: &PyObject) -> PyResult<Self> { |
| 52 | if *obj == py.None() { |
| 53 | Ok(PyNone) |
| 54 | } else { |
| 55 | let msg = format!("Expected None but received {}", obj.get_type(py).name(py)); |
| 56 | Err(PyErr::new_lazy_init( |
| 57 | py.get_type::<exc::TypeError>(), |
| 58 | Some(msg.to_py_object(py).into_object()), |
| 59 | )) |
| 60 | } |
| 61 | } |
| 62 | } |
nothing calls this directly
no test coverage detected