summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-07-21 13:56:18 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-07-23 11:57:20 +0200
commit645122f4b365ce44849afda2ed8a711ae649ed76 (patch)
treea4fd30d42344b6de2bfd14f0e600a16b55828620 /src
parent14ce794a1654f82fe8ac414e56e842242bece729 (diff)
downloadastra-645122f4b365ce44849afda2ed8a711ae649ed76.tar.gz
astra-645122f4b365ce44849afda2ed8a711ae649ed76.tar.bz2
astra-645122f4b365ce44849afda2ed8a711ae649ed76.tar.xz
astra-645122f4b365ce44849afda2ed8a711ae649ed76.zip
Fix 'get_registered' in Matlab with Python 3
Diffstat (limited to 'src')
-rw-r--r--src/PluginAlgorithm.cpp23
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;
}