diff --git a/src/App/FeaturePythonPyImp.h b/src/App/FeaturePythonPyImp.h
index 3926bfff7a..d040ea01b6 100644
--- a/src/App/FeaturePythonPyImp.h
+++ b/src/App/FeaturePythonPyImp.h
@@ -24,6 +24,7 @@
#define APP_FEATUREPYTHONPYIMP_H
#include
+#include
#include
#define PYTHON_TYPE_DEF(_class_, _subclass_) \
diff --git a/src/App/FeaturePythonPyImp.inl b/src/App/FeaturePythonPyImp.inl
index a71e476066..cc6e2acffc 100644
--- a/src/App/FeaturePythonPyImp.inl
+++ b/src/App/FeaturePythonPyImp.inl
@@ -84,12 +84,14 @@ template
FeaturePythonPyT::FeaturePythonPyT(Base::BaseClass *pcObject, PyTypeObject *T)
: FeaturePyT(reinterpret_cast(pcObject), T)
{
+ Base::PyGILStateLocker lock;
dict_methods = PyDict_New();
}
template
FeaturePythonPyT::~FeaturePythonPyT()
{
+ Base::PyGILStateLocker lock;
Py_DECREF(dict_methods);
}