swt2c / rpms / freecad

Forked from rpms/freecad 4 years ago
Clone
3cc518b
--- a/src/Base/swigpyrun.cpp
3cc518b
+++ b/src/Base/swigpyrun.cpp
3cc518b
@@ -35,6 +35,16 @@
3cc518b
 # pragma GCC diagnostic ignored "-Wcast-function-type"
3cc518b
 # endif
3cc518b
 #endif
3cc518b
+
3cc518b
+/* Temporary workaround for PyInterpreterState being made private in Python
3cc518b
+ * 3.8.
3cc518b
+#if PY_VERSION_HEX >= 0x03080000
3cc518b
+# define Py_BUILD_CORE
3cc518b
+#  include "internal/pycore_pystate.h"
3cc518b
+# undef Py_BUILD_CORE
3cc518b
+#endif
3cc518b
+*/
3cc518b
+
3cc518b
 namespace Swig_python {
3cc518b
 #define SWIG_PYTHON_NO_BUILD_NONE
3cc518b
 #include <swigpyrun.h>
3cc518b
--- a/src/Base/swigpyrun.inl
3cc518b
+++ b/src/Base/swigpyrun.inl
3cc518b
@@ -72,7 +72,7 @@ void cleanupSWIG_T(const char* TypeName)
3cc518b
 
3cc518b
     PyObject *module, *dict;
3cc518b
     PyInterpreterState *interp = PyThreadState_GET()->interp;
3cc518b
-    PyObject *modules = interp->modules;
3cc518b
+    PyObject *modules = PyImport_GetModuleDict();
3cc518b
     module = PyDict_GetItemString(modules, "__builtin__");
3cc518b
     if (module != NULL && PyModule_Check(module)) {
3cc518b
         dict = PyModule_GetDict(module);