]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/runtime/PythonNode.cxx
Salome HOME
Optimize usage of context for PythonNode (by deleting input and output port PyObject...
[modules/yacs.git] / src / runtime / PythonNode.cxx
index d0f40b944e9c461cf7475940d33185cf9af92f90..cbc2ff4df921c03d639766b994ace6c465c11a97 100644 (file)
@@ -780,6 +780,8 @@ void PythonNode::executeLocal()
             cerr << endl;
 #endif
             p->put(ob);
+            if(!isUsingPythonCache())
+              PyDict_DelItemString(_context,p->getName().c_str());
           }
     }
     catch(ConversionException& ex)
@@ -790,6 +792,15 @@ void PythonNode::executeLocal()
     if(_autoSqueeze)
       squeezeMemory();
     DEBTRACE( "-----------------End PyNode::outputs-----------------" );
+    if(!isUsingPythonCache())
+    {
+      for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
+      {
+        AutoPyRef pStr = PyUnicode_FromString( (*iter2)->getName().c_str() );
+        if( PyDict_Contains(_context,pStr) == 1 )
+          { PyDict_DelItem(_context,pStr); }
+      }
+    }
   }
   DEBTRACE( "++++++++++++++ End PyNode::execute: " << getName() << " ++++++++++++++++++++" );
 }