-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MESSAGE("SALOME_PYQT_PyInterp::initPython - does nothing");
}
+/*!
+ * Override. Create a distinct context from the SALOME Python console.
+ * Especially the global context is not connected to __main__ as in PyInterp_Interp
+ */
bool SALOME_PYQT_PyInterp::initContext()
{
/*
* It is the caller responsability to acquire the GIL before calling initContext
* It will still be held on initContext exit
*/
- _context = PyDict_New(); // create interpreter dictionnary context
+ _local_context = PyDict_New();
+ _global_context = PyDict_New();
return true;
}
PyErr_Print();
return -1;
}
- PyObject *r = PyEval_EvalCode((PyCodeObject *)code,_context,_context);
+ PyObject *r = PyEval_EvalCode((PyObject *)code,_global_context,_local_context);
Py_DECREF(code);
if(!r){