(
&self,
module: &Py<PyStr>,
from_list: &Py<PyTuple<PyStrRef>>,
level: usize,
)
| 1798 | } |
| 1799 | |
| 1800 | fn import_inner( |
| 1801 | &self, |
| 1802 | module: &Py<PyStr>, |
| 1803 | from_list: &Py<PyTuple<PyStrRef>>, |
| 1804 | level: usize, |
| 1805 | ) -> PyResult { |
| 1806 | let import_func = self |
| 1807 | .builtins |
| 1808 | .get_attr(identifier!(self, __import__), self) |
| 1809 | .map_err(|_| self.new_import_error("__import__ not found", module.to_owned()))?; |
| 1810 | |
| 1811 | let (locals, globals) = if let Some(frame) = self.current_frame() { |
| 1812 | ( |
| 1813 | Some(frame.locals.clone_mapping(self)), |
| 1814 | Some(frame.globals.clone()), |
| 1815 | ) |
| 1816 | } else { |
| 1817 | (None, None) |
| 1818 | }; |
| 1819 | let from_list: PyObjectRef = from_list.to_owned().into(); |
| 1820 | import_func |
| 1821 | .call((module.to_owned(), globals, locals, from_list, level), self) |
| 1822 | .inspect_err(|exc| import::remove_importlib_frames(self, exc)) |
| 1823 | } |
| 1824 | |
| 1825 | pub fn extract_elements_with<T, F>(&self, value: &PyObject, func: F) -> PyResult<Vec<T>> |
| 1826 | where |
no test coverage detected