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

Method dict

src/objects/module.rs:50–55  ·  view source on GitHub ↗

Return the dictionary object that implements module's namespace; this object is the same as the `__dict__` attribute of the module object.

(&self, py: Python)

Source from the content-addressed store, hash-verified

48 /// Return the dictionary object that implements module's namespace;
49 /// this object is the same as the `__dict__` attribute of the module object.
50 pub fn dict(&self, py: Python) -> PyDict {
51 unsafe {
52 let r = PyObject::from_borrowed_ptr(py, ffi::PyModule_GetDict(self.0.as_ptr()));
53 r.unchecked_cast_into::<PyDict>()
54 }
55 }
56
57 unsafe fn str_from_ptr<'a>(&'a self, py: Python, ptr: *const c_char) -> PyResult<&'a str> {
58 if ptr.is_null() {

Callers

nothing calls this directly

Calls 1

as_ptrMethod · 0.45

Tested by

no test coverage detected