diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 62a55a21..5d0b6a44 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -1434,6 +1434,7 @@ void uwsgi_python_hijack(void) { FILE *pyfile; if (up.pyrun) { uwsgi.workers[uwsgi.mywid].hijacked = 1; + UWSGI_GET_GIL; pyfile = fopen(up.pyrun, "r"); if (!pyfile) { uwsgi_error_open(up.pyrun); diff --git a/uwsgi.c b/uwsgi.c index 7f86e1e9..fe4a2269 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -2217,7 +2217,6 @@ skipzero: #ifdef UWSGI_THREADING - if (uwsgi.sockets || uwsgi.gateways_cnt) { if (uwsgi.has_threads) { if (uwsgi.threads > 1) uwsgi.current_wsgi_req = threaded_current_wsgi_req; @@ -2238,7 +2237,6 @@ skipzero: uwsgi.p[i]->enable_threads(); } } - } #endif if (!uwsgi.sockets && !uwsgi.gateways_cnt && !uwsgi.no_server && !uwsgi.udp_socket && !uwsgi.emperor_dir && !uwsgi.command_mode) {