+ constexpr char EXPECTED_COMPARE_FUNC_NAME[]="comptchev";
+ SALOME::AutoPyRef context(PyDict_New());
+ SALOME::AutoPyRef res(PyRun_String(compareFuncContent,Py_file_input,_dsct->getGlobals(),context));
+ if(res.isNull())
+ {
+ std::ostringstream oss; oss << "TransactionRdExtVarFreeStyleCreate ctor : Fail to parse and evaluate \"" << compareFuncContent << "\" as python function !";
+ throw Exception(oss.str());
+ }
+ PyObject *func(PyDict_GetItemString(context,EXPECTED_COMPARE_FUNC_NAME));//borrowed
+ if(!func)
+ {
+ std::ostringstream oss; oss << "TransactionRdExtVarFreeStyleCreate ctor : Parsing of func is OK but not func called \"" << EXPECTED_COMPARE_FUNC_NAME << "\" is the given parsed string !";
+ throw Exception(oss.str());
+ }
+ _cmp_func = func; Py_XINCREF(func);
+ if(PyDict_DelItemString(context,EXPECTED_COMPARE_FUNC_NAME)!=0)
+ {
+ std::ostringstream oss; oss << "TransactionRdExtVarFreeStyleCreate ctor : Internal error during suppression of \"" << EXPECTED_COMPARE_FUNC_NAME << "\" key that exepect to be present ! Smells bad !";
+ throw Exception(oss.str());
+ }