From fc955537a8445a456fa58f9046927399c12a69c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asser=20Schr=C3=B8der=20Fem=C3=B8?= Date: Mon, 20 Jun 2016 10:51:46 +0100 Subject: [PATCH] Fix runtime compatibility with newer Python versions Initial patch by Asser. Change restricted to Python 3.3 and above by me as PyUnicode_DecodeFSDefault was added in 3.3. --- runtime/Server.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/Server.cpp b/runtime/Server.cpp index 286c4dc08..43aa3cb55 100644 --- a/runtime/Server.cpp +++ b/runtime/Server.cpp @@ -126,8 +126,12 @@ Server::Server(quint16 port) { #ifdef PYTHON2 PyList_Append(sysPath, PyString_FromString(path_list.at(i).toUtf8().data())); +#else +#if PY_MINOR_VERSION > 2 + PyList_Append(sysPath, PyUnicode_DecodeFSDefault(path_list.at(i).toUtf8().data())); #else PyList_Append(sysPath, PyBytes_FromString(path_list.at(i).toUtf8().data())); +#endif #endif } }