Remove deprecated PyEval_InitThreads() not needed by Python > 3.6

This commit is contained in:
Richard Berger
2020-12-15 18:23:40 -05:00
parent 162d34d168
commit ccb304fa13

View File

@ -53,7 +53,15 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp)
external_interpreter = Py_IsInitialized();
Py_Initialize();
PyEval_InitThreads();
// only needed for Python 2.x and Python 3 < 3.7
// With Python 3.7 this function is now called by Py_Initialize()
// Deprecated since version 3.9, will be removed in version 3.11
#if PY_MAJOR_VERSION < 3 || PY_MINOR_VERSION < 7
if(!PyEval_ThreadsInitialized()) {
PyEval_InitThreads();
}
#endif
PyGILState_STATE gstate = PyGILState_Ensure();