diff options
-rw-r--r-- | src/PluginAlgorithm.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/PluginAlgorithm.cpp b/src/PluginAlgorithm.cpp index 5c779fd..5d6d733 100644 --- a/src/PluginAlgorithm.cpp +++ b/src/PluginAlgorithm.cpp @@ -249,11 +249,24 @@ std::map<std::string, std::string> CPluginAlgorithmFactory::getRegisteredMap(){ PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(pluginDict, &pos, &key, &value)) { - PyObject * keyb = PyObject_Bytes(key); - PyObject * valb = PyObject_Bytes(value); - ret[PyBytes_AsString(keyb)] = PyBytes_AsString(valb); - Py_DECREF(keyb); - Py_DECREF(valb); + PyObject *keystr = PyObject_Str(key); + if(keystr!=NULL){ + PyObject *valstr = PyObject_Str(value); + if(valstr!=NULL){ + PyObject * keyb = PyObject_CallMethod(six,"b","O",keystr); + if(keyb!=NULL){ + PyObject * valb = PyObject_CallMethod(six,"b","O",valstr); + if(valb!=NULL){ + ret[PyBytes_AsString(keyb)] = PyBytes_AsString(valb); + Py_DECREF(valb); + } + Py_DECREF(keyb); + } + Py_DECREF(valstr); + } + Py_DECREF(keystr); + } + logPythonError(); } return ret; } |