see https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
script += "del _custom_except_hook, sys\n";
PyRun_SimpleString(qUtf8Printable(script));
// VSR (22/09/2016): end of workaround
+#if PY_VERSION_HEX < 0x03070000
PyEval_InitThreads(); // Create (and acquire) the interpreter lock - can be called many times
+#endif
// Py_InitThreads acquires the GIL
PyThreadState *pts = PyGILState_GetThisThreadState();
PyEval_ReleaseThread(pts);
Py_Initialize(); // Initialize the interpreter
PySys_SetArgv(_argc, changed_argv);
+#if PY_VERSION_HEX < 0x03070000
PyEval_InitThreads(); // Create (and acquire) the Python global interpreter lock (GIL)
+#endif
PyEval_SaveThread(); // release safely GIL
}
}