| 135 | } |
| 136 | |
| 137 | Result<bool> IsModuleImported(const std::string& module_name) { |
| 138 | // PyImport_GetModuleDict returns with a borrowed reference |
| 139 | OwnedRef key(PyUnicode_FromString(module_name.c_str())); |
| 140 | auto is_imported = PyDict_Contains(PyImport_GetModuleDict(), key.obj()); |
| 141 | RETURN_IF_PYERROR(); |
| 142 | return is_imported; |
| 143 | } |
| 144 | |
| 145 | Status ImportModule(const std::string& module_name, OwnedRef* ref) { |
| 146 | PyObject* module = PyImport_ImportModule(module_name.c_str()); |
nothing calls this directly
no outgoing calls
no test coverage detected