(&self, py: Python)
| 89 | /// May fail if the module does not have a `__file__` attribute. |
| 90 | #[cfg(feature = "python3-sys")] |
| 91 | pub fn filename_object(&self, py: Python) -> PyResult<PyObject> { |
| 92 | let ptr = unsafe { ffi::PyModule_GetFilenameObject(self.0.as_ptr()) }; |
| 93 | if ptr.is_null() { |
| 94 | Err(PyErr::fetch(py)) |
| 95 | } else { |
| 96 | Ok(unsafe { PyObject::from_borrowed_ptr(py, ptr) }) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /// Gets a member from the module. |
| 101 | /// This is equivalent to the Python expression: `getattr(module, name)` |