MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / filename_object

Method filename_object

src/objects/module.rs:91–98  ·  view source on GitHub ↗
(&self, py: Python)

Source from the content-addressed store, hash-verified

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)`

Callers

nothing calls this directly

Calls 1

as_ptrMethod · 0.45

Tested by

no test coverage detected