Pārlūkot izejas kodu

Use Py_IsInitialized() instead of PyEval_ThreadsInitialized()

Since PyEval_InitThreads() hasn't been called, PyEval_ThreadsInitialized()
won't return True.

Calling PyEval_InitThreads() shouldn't be call if not needed, indeed as mention
in the documentation calling this function initialize and acquire the global
interpreter lock which cause an unnecessary overhead.
Jean-Christophe Fillion-Robin 14 gadi atpakaļ
vecāks
revīzija
e93bbba8d8

+ 1 - 1
Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

@@ -49,7 +49,7 @@ ctkAbstractPythonManager::ctkAbstractPythonManager(QObject* _parent) : Superclas
 //-----------------------------------------------------------------------------
 ctkAbstractPythonManager::~ctkAbstractPythonManager()
 {
-  if (PyEval_ThreadsInitialized())
+  if (Py_IsInitialized())
     {
     PyThreadState* state = PyThreadState_Get();
     Py_EndInterpreter(state);