From: jfa Date: Mon, 19 Dec 2022 10:35:14 +0000 (+0300) Subject: [bos #33210] [CEA] building SALOME on Fedora 37. SHAPER-Python3.11_co_code.patch... X-Git-Tag: V9_11_0a1~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a7c30b716187d1293d62db454c220f5c53fdd9f7;p=modules%2Fshaper.git [bos #33210] [CEA] building SALOME on Fedora 37. SHAPER-Python3.11_co_code.patch applied. --- diff --git a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp index 0aab9a2c7..0569e96eb 100644 --- a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp +++ b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp @@ -24,6 +24,7 @@ #include #include #include +#include InitializationPlugin_PyInterp::InitializationPlugin_PyInterp() : PyInterp_Interp() @@ -118,7 +119,11 @@ std::list InitializationPlugin_PyInterp::compile(const std::wstrin } PyCodeObject* aCodeObj = (PyCodeObject*) aCodePyObj; +#if PY_VERSION_HEX >= 0x030B0000 + std::string aCodeName(PyBytes_AsString(PyObject_GetAttrString((PyObject *)(aCodeObj), "co_code"))); +#else std::string aCodeName(PyBytes_AsString(aCodeObj->co_code)); +#endif // co_names should be tuple, but can be changed in modern versions of python (>2.7.3) if(!PyTuple_Check(aCodeObj->co_names)) { return aResult;