Skip to content

Commit

Permalink
Fix ubuntu 19.04 error
Browse files Browse the repository at this point in the history
RuntimeError: FATAL: module compiled as little endian, but detected different endianness at runtime

see also ros-perception/vision_opencv#292
and ros-melodic-arch/ros-melodic-cv-bridge#2
  • Loading branch information
2maz committed Apr 30, 2020
1 parent 8878224 commit e34dfb5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions plugins/PythonMars/src/PythonInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct ListBuilderState
bool knownType = true;

if(PyBool_Check(obj)) {
item = (bool)PyObject_IsTrue(obj);
item = (bool)PyObject_IsTrue(obj);
}
else if(PyInt_Check(obj)) {
item = (int)PyInt_AsLong(obj);
Expand All @@ -288,10 +288,10 @@ struct ListBuilderState
item = PyFloat_AsDouble(obj);
}
else if(PyString_Check(obj)) {
item = PyString_AsString(obj);
item = PyString_AsString(obj);
}
else if(PyList_Check(obj)) {
const unsigned size = PyList_Size(obj);
const unsigned size = PyList_Size(obj);
for(unsigned i = 0; i < size; i++) {
PyObject *elem = PyList_GetItem(obj, i);
item[(int)i] = ConfigItem();
Expand All @@ -300,7 +300,7 @@ struct ListBuilderState
}
else if(PyDict_Check(obj)) {
PyObject *keyList = PyDict_Keys(obj);
const unsigned size = PyList_Size(keyList);
const unsigned size = PyList_Size(keyList);
for(unsigned i = 0; i < size; i++) {
PyObject *key = PyList_GetItem(keyList, i);
item[std::string(PyString_AsString(key))];
Expand All @@ -324,7 +324,7 @@ struct ListBuilderState
PyObject* obj = mapToPyObjectPtr_(it->second);
if(obj) {
PyDict_SetItemString(dict, it->first.c_str(), obj);
Py_XDECREF(obj);
Py_XDECREF(obj);
}
}
return dict;
Expand All @@ -334,9 +334,9 @@ struct ListBuilderState
ConfigVector::iterator it = map->begin();
for(; it!=map->end(); ++it) {
PyObject* obj = mapToPyObjectPtr_(*it);
if(obj) {
if(obj) {
PyList_Append(list, obj);
Py_XDECREF(obj);
Py_XDECREF(obj);
}
}
return list;
Expand All @@ -360,7 +360,7 @@ struct ListBuilderState
}
return NULL;
}

PyObjectPtr mapToPyObjectPtr(ConfigMap *map) {
ConfigItem item(*map);
return makePyObjectPtr(mapToPyObjectPtr_(&item));
Expand Down Expand Up @@ -444,6 +444,7 @@ struct ListBuilderState
#if PYTHON_VERSION == 3
int initNumpy() {
import_array();
return NULL;
#else
void initNumpy() {
import_array();
Expand Down

0 comments on commit e34dfb5

Please sign in to comment.