mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-01 11:15:57 +00:00
add a check for already initialized python vm
This commit is contained in:
@@ -197,6 +197,12 @@ int uwsgi_python_init() {
|
||||
uwsgi_log_initial("Python version: %.*s %s\n", pyversion-Py_GetVersion(), Py_GetVersion(), Py_GetCompiler()+1);
|
||||
}
|
||||
|
||||
if (Py_IsInitialized()) {
|
||||
uwsgi_log("--- Python VM already initialized ---\n");
|
||||
PyGILState_Ensure();
|
||||
goto ready;
|
||||
}
|
||||
|
||||
if (up.home != NULL) {
|
||||
#ifdef PYTHREE
|
||||
// check for PEP 405 virtualenv (starting from python 3.3)
|
||||
@@ -251,6 +257,8 @@ pep405:
|
||||
|
||||
Py_Initialize();
|
||||
|
||||
ready:
|
||||
|
||||
if (!uwsgi.has_threads) {
|
||||
uwsgi_log_initial("*** Python threads support is disabled. You can enable it with --enable-threads ***\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user