|
|
// Return the named attribute object from the named module. | // Return the named attribute object from the named module. |
PyObject *PyCustomWidgets::getModuleAttr(const char *module, const char *attr) | PyObject *PyCustomWidgets::getModuleAttr(const char *module, const char *attr) |
{ | { |
#if PY_VERSION_HEX >= 0x020500 |
#if PY_VERSION_HEX >= 0x02050000 |
PyObject *mod = PyImport_ImportModule(module); | PyObject *mod = PyImport_ImportModule(module); |
#else | #else |
PyObject *mod = PyImport_ImportModule(const_cast<char *>(module)); | PyObject *mod = PyImport_ImportModule(const_cast<char *>(module)); |
|
|
return 0; | return 0; |
} | } |
| |
#if PY_VERSION_HEX >= 0x020500 |
#if PY_VERSION_HEX >= 0x02050000 |
PyObject *obj = PyObject_GetAttrString(mod, attr); | PyObject *obj = PyObject_GetAttrString(mod, attr); |
#else | #else |
PyObject *obj = PyObject_GetAttrString(mod, const_cast<char *>(attr)); | PyObject *obj = PyObject_GetAttrString(mod, const_cast<char *>(attr)); |