| 128 | } |
| 129 | |
| 130 | Status PyObject_StdStringStr(PyObject* obj, std::string* out) { |
| 131 | OwnedRef string_ref(PyObject_Str(obj)); |
| 132 | RETURN_IF_PYERROR(); |
| 133 | return PyUnicode_AsStdString(string_ref.obj(), out); |
| 134 | } |
| 135 | |
| 136 | Result<bool> IsModuleImported(const std::string& module_name) { |
| 137 | // PyImport_GetModuleDict returns with a borrowed reference |