Skip to content
Snippets Groups Projects
Commit eca9df05 authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Walter Lampl
Browse files

Fix PyEval_InitThreads() and PyEval_ThreadsInitialized() deprecated warnings . Part II

parent 3e2c18fb
No related branches found
No related tags found
No related merge requests found
...@@ -175,7 +175,10 @@ bool psc::Psc::configure(const ptree& config) ...@@ -175,7 +175,10 @@ bool psc::Psc::configure(const ptree& config)
ERS_DEBUG(1,"Initializing Python interpreter"); ERS_DEBUG(1,"Initializing Python interpreter");
Py_Initialize(); Py_Initialize();
if (!PyEval_ThreadsInitialized()) PyEval_InitThreads();
/*
* The GIL is initialized by Py_Initialize() since Python 3.7."
*/
// check // check
if ( ! Py_IsInitialized() ) { if ( ! Py_IsInitialized() ) {
...@@ -676,10 +679,8 @@ bool psc::Psc::prepareWorker (const boost::property_tree::ptree& args) ...@@ -676,10 +679,8 @@ bool psc::Psc::prepareWorker (const boost::property_tree::ptree& args)
/* Release the Python GIL (which we inherited from the mother) /* Release the Python GIL (which we inherited from the mother)
to avoid dead-locking on the first call to Python. Only relevant to avoid dead-locking on the first call to Python. Only relevant
if Python is initialized and Python-based algorithms are used. */ if Python is initialized and Python-based algorithms are used. */
if (PyEval_ThreadsInitialized()) { ERS_DEBUG(1, "Releasing Python GIL");
ERS_DEBUG(1, "Releasing Python GIL"); PyEval_SaveThread();
PyEval_SaveThread();
}
} }
m_workerID = args.get<int>("workerId"); m_workerID = args.get<int>("workerId");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment