PyUnicode_AsUTF8 breaks python 2.x compatibility

This commit is contained in:
erwin coumans
2021-05-06 10:19:15 -07:00
parent e4ff5a45d4
commit 8e85dedaa9

View File

@@ -137,12 +137,20 @@ static const char* pybullet_internalGetCStringFromSequence(PyObject* seq, int in
if (PyList_Check(seq))
{
item = PyList_GET_ITEM(seq, index);
#if PY_MAJOR_VERSION >= 3
v = PyUnicode_AsUTF8(item);
#else
v = PyBytes_AsString(item);
#endif
}
else
{
item = PyTuple_GET_ITEM(seq, index);
#if PY_MAJOR_VERSION >= 3
v = PyUnicode_AsUTF8(item);
#else
v = PyBytes_AsString(item);
#endif
}
return v;
}