From 9fcb98d9c66da4c514b266b54de65fba425bdbf5 Mon Sep 17 00:00:00 2001 From: Uwe Date: Sun, 19 Jun 2022 16:23:13 +0200 Subject: [PATCH] Revert "remove unused python<3.6 code" This reverts commit 0a6d27112156a2b1fffaedcf16bcedab3e2835ec. --- src/Mod/Part/App/AppPartPy.cpp | 10 ++++++++-- src/Tools/generateTemplates/templateClassPyExport.py | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index aa6e9120b9..82686cdd4b 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1912,8 +1912,11 @@ private: 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 #if PY_VERSION_HEX < 0x03090000 unichars = PyUnicode_AS_UNICODE(p); #else @@ -1921,8 +1924,11 @@ private: #endif } else if (PyUnicode_Check(intext)) { +#if PY_VERSION_HEX >= 0x03030000 pysize = PyUnicode_GetLength(intext); - +#else + pysize = PyUnicode_GetSize(intext); +#endif #if PY_VERSION_HEX < 0x03090000 unichars = PyUnicode_AS_UNICODE(intext); #else diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index 96a262598e..0ea79f3a25 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -422,9 +422,11 @@ PyNumberMethods @self.export.Name@::Number[] = { { number_divide_handler, /*nb_true_divide*/ nullptr, /*nb_inplace_floor_divide*/ nullptr, /*nb_inplace_true_divide*/ - nullptr, /*nb_index*/ - nullptr, /*nb_matrix_multiply*/ - nullptr /*nb_inplace_matrix_multiply*/ + nullptr /*nb_index*/ +#if PY_VERSION_HEX >= 0x03050000 + ,nullptr /*nb_matrix_multiply*/ + ,nullptr /*nb_inplace_matrix_multiply*/ +#endif } }; -