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