Salome HOME
Fix for import/export features
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_PyInterp.cpp
index 7a5f42c4fe5243e9abf000951c50ce36971aded1..53659f23fdbd89ab61bc1438f5a380aa2575e536 100644 (file)
@@ -69,6 +69,12 @@ void ParametersPlugin_PyInterp::extendLocalContext(const std::list<std::string>&
   }
 }
 
+void ParametersPlugin_PyInterp::clearLocalContext()
+{
+  PyLockWrapper lck;
+  PyDict_Clear(_local_context);
+}
+
 
 double ParametersPlugin_PyInterp::evaluate(const std::string& theExpression, std::string& theError)
 {
@@ -130,7 +136,14 @@ bool ParametersPlugin_PyInterp::initContext()
   }
   _global_context = PyModule_GetDict(m);          // get interpreter global variable context
   Py_INCREF(_global_context);
-  _local_context = _global_context;
+  _local_context = PyDict_New();
+  Py_INCREF(_local_context);
 
   return PyRun_SimpleString("from math import *") == 0;
 }
+
+void ParametersPlugin_PyInterp::closeContext()
+{
+  Py_XDECREF(_local_context);
+  PyInterp_Interp::closeContext();
+}