From: sbh Date: Mon, 27 Apr 2015 12:30:52 +0000 (+0300) Subject: Separate local contexts of parameter's and pyconsole interpreters X-Git-Tag: V_1.2.0~182 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e0f5ac68413c024fb2ecf21c09a80f05e0c57c9;p=modules%2Fshaper.git Separate local contexts of parameter's and pyconsole interpreters --- diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.h b/src/ParametersPlugin/ParametersPlugin_Parameter.h index c36d7764f..db6c54c51 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.h +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.h @@ -20,8 +20,8 @@ class ParametersPlugin_Parameter : public ModelAPI_Feature /// Extrusion kind inline static const std::string& ID() { - static const std::string MY_EXTRUSION_ID("Parameter"); - return MY_EXTRUSION_ID; + static const std::string MY_PARAMETER_ID("Parameter"); + return MY_PARAMETER_ID; } /// attribute name of references sketch entities list, it should contain a sketch result or /// a pair a sketch result to sketch face diff --git a/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp b/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp index 4afbfaa2a..53659f23f 100644 --- a/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp +++ b/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp @@ -136,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(); +} diff --git a/src/ParametersPlugin/ParametersPlugin_PyInterp.h b/src/ParametersPlugin/ParametersPlugin_PyInterp.h index 0e3cdee56..0a631f6e2 100644 --- a/src/ParametersPlugin/ParametersPlugin_PyInterp.h +++ b/src/ParametersPlugin/ParametersPlugin_PyInterp.h @@ -29,6 +29,7 @@ class PARAMETERSPLUGIN_EXPORT ParametersPlugin_PyInterp : public PyInterp_Interp std::string errorMessage(); // Overrides PyInterp_Interp virtual bool initContext(); + virtual void closeContext(); }; #endif /* PARAMETERSPLUGIN_PYINTERP_H_ */