Fix deprecation warning. PyEval_InitThreads() is not needed for Python >= 3.7

See: https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads

With Python 3.7 this function is called by Py_Initialize()
With Python 3.9 this function is deprecated and does nothing
This commit is contained in:
Thomas Pointhuber 2020-12-27 19:18:49 +01:00
parent ac1f7f93a2
commit 3b25e7344a
1 changed files with 4 additions and 1 deletions

View File

@ -183,7 +183,10 @@ bool pcbnewInitPythonScripting( const char * aUserScriptingPath )
PySys_SetArgv( Pgm().App().argc, Pgm().App().argv ); PySys_SetArgv( Pgm().App().argc, Pgm().App().argv );
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
#if PY_VERSION_HEX < 0x03070000 // PyEval_InitThreads() is called by Py_Initialize() starting with version 3.7
PyEval_InitThreads(); PyEval_InitThreads();
#endif // if PY_VERSION_HEX < 0x03070000
#ifndef KICAD_SCRIPTING_WXPYTHON_PHOENIX #ifndef KICAD_SCRIPTING_WXPYTHON_PHOENIX
#ifndef __WINDOWS__ // import wxversion.py currently not working under winbuilder, and not useful. #ifndef __WINDOWS__ // import wxversion.py currently not working under winbuilder, and not useful.
@ -211,7 +214,7 @@ bool pcbnewInitPythonScripting( const char * aUserScriptingPath )
Py_Finalize(); Py_Finalize();
return false; return false;
} }
#endif #endif // ifndef KICAD_SCRIPTING_WXPYTHON_PHOENIX
#if defined( DEBUG ) #if defined( DEBUG )
RedirectStdio(); RedirectStdio();