acquire GIL before updating python path
This commit is contained in:
@ -49,14 +49,19 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) {
|
||||
python->init();
|
||||
|
||||
// add current directory to PYTHONPATH
|
||||
PyObject * py_path = PySys_GetObject((char *)"path");
|
||||
|
||||
PyGILState_STATE gstate = PyGILState_Ensure();
|
||||
PyObject *py_path = PySys_GetObject((char *)"path");
|
||||
PyList_Append(py_path, PY_STRING_FROM_STRING("."));
|
||||
|
||||
// if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well
|
||||
const char * potentials_path = getenv("LAMMPS_POTENTIALS");
|
||||
// if LAMMPS_POTENTIALS environment variable is set,
|
||||
// add it to PYTHONPATH as well
|
||||
|
||||
const char *potentials_path = getenv("LAMMPS_POTENTIALS");
|
||||
if (potentials_path != nullptr) {
|
||||
PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
|
||||
}
|
||||
PyGILState_Release(gstate);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user