Salome HOME
Issue #2481: Application error when create fillet
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Tools.cpp
index b8415681e9ae09efc9b040f3be52023a74e8b32c..ce7245fba164afd585ffec1eabb1f85f06ab2123 100644 (file)
@@ -405,6 +405,8 @@ std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
 bool checkPythonDump()
 {
   SessionPtr aSession = ModelAPI_Session::get();
+  // 2431: set PartSet as a current document
+  aSession->setActiveDocument(aSession->moduleDocument(), true);
   // dump all to the python file
   aSession->startOperation("Check python dump");
   FeaturePtr aDump = aSession->moduleDocument()->addFeature("Dump");
@@ -437,8 +439,10 @@ bool checkPythonDump()
   aSession->closeAll();
   // execute the dumped
   PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */
-  PyObject* PyFileObject = PyFile_FromString("./check_dump.py", "r");
-  PyRun_SimpleFileEx(PyFile_AsFile(PyFileObject), "./check_dump.py", 1);
+  static char aDumpName[] = "./check_dump.py";
+  static char aReadMode[] = "r";
+  PyObject* PyFileObject = PyFile_FromString(aDumpName, aReadMode);
+  PyRun_SimpleFileEx(PyFile_AsFile(PyFileObject), aDumpName, 1);
   PyGILState_Release(gstate); /* release python thread */
 
   // compare with the stored data