]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[bos #33210] [CEA] building SALOME on Fedora 37. SHAPER-Python3.11_co_code.patch...
authorjfa <jfa@opencascade.com>
Mon, 19 Dec 2022 10:35:14 +0000 (13:35 +0300)
committerjfa <jfa@opencascade.com>
Mon, 19 Dec 2022 10:35:14 +0000 (13:35 +0300)
src/InitializationPlugin/InitializationPlugin_PyInterp.cpp

index 0aab9a2c76a4cf260438b05519004f744fbd3bd2..0569e96eb6d932e55a6ccc7df4fac850f4c0fd3d 100644 (file)
@@ -24,6 +24,7 @@
 #include <string>
 #include <stdexcept>
 #include <clocale>
+#include <Python.h>
 
 InitializationPlugin_PyInterp::InitializationPlugin_PyInterp()
 : PyInterp_Interp()
@@ -118,7 +119,11 @@ std::list<std::wstring> 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;