diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index 4723a9cce89f..55a5910184cb 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -45,7 +45,13 @@ ResolvePythonName(const char* name, return NULL; } - if (!PyDict_Check(pmodule)) + if (PyType_Check(pmodule)) + { + main_dict = ((PyTypeObject*)pmodule)->tp_dict; + if (!main_dict) + return NULL; + } + else if (!PyDict_Check(pmodule)) { main_dict = PyModule_GetDict (pmodule); if (!main_dict)