From 8ed90c858645e7562d9534265b6025d39ab4ffd6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 12 Jun 2020 16:02:13 +0200 Subject: [PATCH] Py2: fix Python 2 build failure --- src/Mod/Part/App/AppPartPy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index b4143b1520a6..aa407ac12a9d 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1841,11 +1841,19 @@ class Module : public Py::ExtensionModule if (!p) { throw Py::TypeError("** makeWireString can't convert PyString."); } +#if PY_VERSION_HEX >= 0x03030000 pysize = PyUnicode_GetLength(p); +#else + pysize = PyUnicode_GetSize(p); +#endif unichars = PyUnicode_AS_UNICODE(p); } else if (PyUnicode_Check(intext)) { +#if PY_VERSION_HEX >= 0x03030000 pysize = PyUnicode_GetLength(intext); +#else + pysize = PyUnicode_GetSize(intext); +#endif unichars = PyUnicode_AS_UNICODE(intext); } else {