(vm: &VirtualMachine, module_name: &str, content: &str)
| 142 | |
| 143 | #[cfg(feature = "rustpython-compiler")] |
| 144 | pub fn import_source(vm: &VirtualMachine, module_name: &str, content: &str) -> PyResult { |
| 145 | let code = vm |
| 146 | .compile_with_opts( |
| 147 | content, |
| 148 | crate::compiler::Mode::Exec, |
| 149 | "<source>".to_owned(), |
| 150 | vm.compile_opts(), |
| 151 | ) |
| 152 | .map_err(|err| vm.new_syntax_error(&err, Some(content)))?; |
| 153 | import_code_obj(vm, module_name, code, false) |
| 154 | } |
| 155 | |
| 156 | /// If `__spec__._initializing` is true, wait for the module to finish |
| 157 | /// initializing by calling `_lock_unlock_module`. |
no test coverage detected