stabilization fixes

This commit is contained in:
roberto@sirius
2010-10-01 11:50:00 +02:00
parent 74b9579531
commit 2bf20631e1
4 changed files with 12 additions and 12 deletions
+9 -4
View File
@@ -79,7 +79,6 @@ int init_uwsgi_app(int loader, void *arg1, struct uwsgi_server *uwsgi, int new_i
// Initialize a new environment for the new interpreter
if (new_interpreter && id) {
uwsgi_log("setting new interpreter\n");
wi->interpreter = Py_NewInterpreter();
if (!wi->interpreter) {
uwsgi_log( "unable to initialize the new python interpreter\n");
@@ -94,12 +93,15 @@ int init_uwsgi_app(int loader, void *arg1, struct uwsgi_server *uwsgi, int new_i
#endif
init_uwsgi_vars();
}
else {
wi->interpreter = uwsgi->main_thread;
}
wi->wsgi_callable = uwsgi->loaders[loader](arg1);
if (!wi->wsgi_callable) {
uwsgi_log("unable to find \"%.*s\" callable\n", wsgi_req->wsgi_callable_len, wsgi_req->wsgi_callable);
uwsgi_log("unable to load app SCRIPT_NAME=%s\n", mountpoint);
goto doh;
}
@@ -140,6 +142,9 @@ int init_uwsgi_app(int loader, void *arg1, struct uwsgi_server *uwsgi, int new_i
}
}
// avoid __code__ attr error propagation
PyErr_Clear();
if (zero) {
zero = PyObject_GetAttrString(zero, "co_argcount");
wi->argc = (int) PyInt_AsLong(zero);
@@ -216,10 +221,10 @@ int init_uwsgi_app(int loader, void *arg1, struct uwsgi_server *uwsgi, int new_i
}
if (wi->argc == 1) {
uwsgi_log( "Web3 application %d (SCRIPT_NAME=%.*s) ready", id, wi->mountpoint_len, wi->mountpoint);
uwsgi_log( "Web3 application %d (SCRIPT_NAME=%.*s) ready on interpreter %p", id, wi->mountpoint_len, wi->mountpoint, wi->interpreter);
}
else {
uwsgi_log( "WSGI application %d (SCRIPT_NAME=%.*s) ready", id, wi->mountpoint_len, wi->mountpoint);
uwsgi_log( "WSGI application %d (SCRIPT_NAME=%.*s) ready on interpreter %p", id, wi->mountpoint_len, wi->mountpoint, wi->interpreter);
}
if (id == 0) {
-4
View File
@@ -1609,8 +1609,6 @@ void init_uwsgi_vars() {
PyObject *site_module;
#endif
uwsgi_log("AAAAAAA\n");
/* add cwd to pythonpath */
pysys = PyImport_ImportModule("sys");
if (!pysys) {
@@ -1628,8 +1626,6 @@ void init_uwsgi_vars() {
// simulate a pythonhome directive
if (uwsgi.wsgi_req->pyhome_len > 0) {
uwsgi_log("TEST000\n");
PyObject *venv_path = UWSGI_PYFROMSTRINGSIZE(uwsgi.wsgi_req->pyhome, uwsgi.wsgi_req->pyhome_len) ;
#ifdef UWSGI_DEBUG
+2 -3
View File
@@ -188,8 +188,7 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
wi = &uwsgi->apps[wsgi_req->app_id];
if (uwsgi->single_interpreter == 0 && wsgi_req->app_id) {
uwsgi_log("SWAPPING INTERPRETER\n");
if (uwsgi->single_interpreter == 0 && wsgi_req->app_id > 0) {
if (!wi->interpreter) {
internal_server_error(wsgi_req->poll.fd, "wsgi application's %d interpreter not found");
goto clear2;
@@ -358,7 +357,7 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
clear:
if (uwsgi->single_interpreter == 0 && wsgi_req->app_id) {
if (uwsgi->single_interpreter == 0 && wsgi_req->app_id > 0) {
// restoring main interpreter
PyThreadState_Swap(uwsgi->main_thread);
}
+1 -1
View File
@@ -194,7 +194,7 @@ next:
continue;
}
//init_uwsgi_app(&uwsgi, PyDict_GetItemString(uwsgi.pyloader_dict, (char *) node2->children->content) );
init_uwsgi_app(LOADER_STRING_CALLABLE, (void *) node2->children->content, &uwsgi, uwsgi.single_interpreter-1);
}
else if (!strcmp((char *) node2->name, "eval")) {
if (!node2->children) {