From 8e85dedaa9dc6b98cdced1a1edae1eadab9ce869 Mon Sep 17 00:00:00 2001 From: erwin coumans Date: Thu, 6 May 2021 10:19:15 -0700 Subject: [PATCH] PyUnicode_AsUTF8 breaks python 2.x compatibility --- examples/pybullet/pybullet.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index f0637919d..f2a72a76d 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -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; }