{
AutoGIL gstate;
_localfilename = name;
- PyObject *result = PyObject_CallMethod(_pyCont,(char*)"setLogFileName","s",name,nullptr);
+ AutoPyRef result = PyObject_CallMethod(_pyCont,(char*)"setLogFileName","s",name,nullptr);
if (PyErr_Occurred())
{
std::string error("can not set logfilename");
CORBA::Long Abstract_Engines_Container_i::monitoringtimeresms()
{
AutoGIL gstate;
- PyObject *result = PyObject_CallMethod(_pyCont,(char*)"monitoringtimeresms",nullptr);
+ AutoPyRef result = PyObject_CallMethod(_pyCont,(char*)"monitoringtimeresms",nullptr);
if (PyErr_Occurred())
{
std::string error("can not retrieve time interval between 2 measures");
THROW_SALOME_CORBA_EXCEPTION(error.c_str(),SALOME::INTERNAL_ERROR);
}
CORBA::Long ret = PyLong_AsLong( result );
- Py_XDECREF(result);
return ret;
}
void Abstract_Engines_Container_i::monitoringtimeresms(CORBA::Long intervalInMs)
{
AutoGIL gstate;
- PyObject *result = PyObject_CallMethod(_pyCont,(char*)"SetMonitoringtimeresms","i",intervalInMs,nullptr);
+ AutoPyRef result = PyObject_CallMethod(_pyCont,(char*)"SetMonitoringtimeresms","i",intervalInMs,nullptr);
if (PyErr_Occurred())
{
std::string error("can not set time interval between 2 measures");
PyErr_Print();
THROW_SALOME_CORBA_EXCEPTION(error.c_str(),SALOME::INTERNAL_ERROR);
}
- Py_XDECREF(result);
}
void Abstract_Engines_Container_i::verbosity(bool& activated, CORBA::String_out level)
SALOME::SetVerbosityLevelStr( level );
{
AutoGIL gstate;
- PyObject *res = PyObject_CallMethod(_pyCont,
+ AutoPyRef res = PyObject_CallMethod(_pyCont,
(char*)"positionVerbosityOfLogger",NULL);
if(res==NULL)
{
{
AutoGIL gstate;
PyObject *module = PyImport_ImportModuleNoBlock((char*)"salome_psutil");
- PyObject *result = PyObject_CallMethod(module,
+ AutoPyRef result = PyObject_CallMethod(module,
(char*)"getNumberOfCPUCores", NULL);
int n = PyLong_AsLong(result);
- Py_DECREF(result);
-
return (CORBA::Long)n;
}
{
AutoGIL gstate;
PyObject *module = PyImport_ImportModuleNoBlock((char*)"salome_psutil");
- PyObject *result = PyObject_CallMethod(module,
+ AutoPyRef result = PyObject_CallMethod(module,
(char*)"loadOfCPUCores", "s",
_load_script.c_str());
if (PyErr_Occurred())
int n = this->getNumberOfCPUCores();
if (!PyList_Check(result) || PyList_Size(result) != n) {
// bad number of cores
- Py_DECREF(result);
SALOME::ExceptionStruct es;
es.type = SALOME::INTERNAL_ERROR;
es.text = "wrong number of cores";
if (foo < 0.0 || foo > 1.0)
{
// value not in [0, 1] range
- Py_DECREF(result);
SALOME::ExceptionStruct es;
es.type = SALOME::INTERNAL_ERROR;
es.text = "load not in [0, 1] range";
loads[i] = foo;
}
- Py_DECREF(result);
-
return loads._retn();
}
{
AutoGIL gstate;
PyObject *module = PyImport_ImportModuleNoBlock((char*)"salome_psutil");
- PyObject *result = PyObject_CallMethod(module,
+ AutoPyRef result = PyObject_CallMethod(module,
(char*)"getTotalPhysicalMemory", NULL);
int n = PyLong_AsLong(result);
- Py_DECREF(result);
return (CORBA::Long)n;
}
{
AutoGIL gstate;
PyObject *module = PyImport_ImportModuleNoBlock((char*)"salome_psutil");
- PyObject *result = PyObject_CallMethod(module,
+ AutoPyRef result = PyObject_CallMethod(module,
(char*)"getTotalPhysicalMemoryInUse", NULL);
int n = PyLong_AsLong(result);
- Py_DECREF(result);
return (CORBA::Long)n;
}
{
AutoGIL gstate;
PyObject *module = PyImport_ImportModuleNoBlock((char*)"salome_psutil");
- PyObject *result = PyObject_CallMethod(module,
+ AutoPyRef result = PyObject_CallMethod(module,
(char*)"getTotalPhysicalMemoryInUseByMe", NULL);
int n = PyLong_AsLong(result);
- Py_DECREF(result);
return (CORBA::Long)n;
}
{
AutoGIL gstate;
- PyObject *result = PyObject_CallMethod(_pyCont,
+ AutoPyRef result = PyObject_CallMethod(_pyCont,
(char*)"import_component",
(char*)"s",componentName);
reason=PyUnicode_AsUTF8(result);
- Py_XDECREF(result);
SCRUTE(reason);
}
std::string iors;
{
AutoGIL gstate;
- PyObject *result = PyObject_CallMethod(_pyCont,
+ AutoPyRef result = PyObject_CallMethod(_pyCont,
(char*)"create_component_instance",
(char*)"ss",
CompName.c_str(),
PyArg_ParseTuple(result,"ss", &ior, &error);
iors = ior;
reason=error;
- Py_DECREF(result);
}
if( iors!="" )
char * _ior = nullptr;
{
AutoGIL gstate;
- PyObject *result = PyObject_CallMethod(_pyCont,
+ AutoPyRef result = PyObject_CallMethod(_pyCont,
(char*)"create_component_instance",
(char*)"ss",
CompName,
PyArg_ParseTuple(result,"ss", &ior, &error);
reason = CORBA::string_dup(error);
_ior = CORBA::string_dup(ior);
- Py_DECREF(result);
}
return _ior;
}
std::string astr;
{
AutoGIL gstate;
- PyObject *res = PyObject_CallMethod(_pyCont,
+ AutoPyRef res = PyObject_CallMethod(_pyCont,
(char*)"create_pyscriptnode",
(char*)"ss",
nodeName,
code);
- if(res==NULL)
+ if( res.isNull() )
{
//internal error
PyErr_Print();
ierr=PyLong_AsLong(PyTuple_GetItem(res,0));
PyObject* result=PyTuple_GetItem(res,1);
astr = PyUnicode_AsUTF8(result);
- Py_DECREF(res);
}
if(ierr==0)
from SALOME_utilities import *
from Utils_Identity import getShortHostName
from salome_utils import verbose
-from KernelBasis import VerbosityActivated
+from KernelBasis import VerbosityActivated,getSSLMode
#=============================================================================
def create_pyscriptnode(self,nodeName,code):
try:
- logscript = self._log.addScript(nodeName,code)
+ logscript = None
+ if getSSLMode():
+ logscript = self._log.addScript(nodeName,code)
node=SALOME_PyNode.PyScriptNode_i(nodeName,code,self._poa,self, logscript)
id_o = self._poa.activate_object(node)
comp_o = self._poa.id_to_reference(id_o)
return self._timeIntervalInMs
def setLogFileName(self, logFileName):
- self._log = self.logm.declareContainer( self._containerName, logFileName )
+ if getSSLMode():
+ self._log = self.logm.declareContainer( self._containerName, logFileName )
def SetMonitoringtimeresms(self , value):
self._timeIntervalInMs = value