diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 4ef45605..932168a7 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -324,13 +324,16 @@ void init_uwsgi_vars() { PyErr_Print(); } - for (i = 0; i < up.python_path_cnt; i++) { - if (PyList_Insert(pypath, 0, UWSGI_PYFROMSTRING(up.python_path[i])) != 0) { + struct uwsgi_string_list *uppp = up.python_path; + while(uppp) { + if (PyList_Insert(pypath, 0, UWSGI_PYFROMSTRING(uppp->value)) != 0) { PyErr_Print(); } else { - uwsgi_log("added %s to pythonpath.\n", up.python_path[i]); + uwsgi_log("added %s to pythonpath.\n", uppp->value); } + + uppp = uppp->next; } for (i = 0; i < up.pymodule_alias_cnt; i++) { @@ -679,13 +682,7 @@ int uwsgi_python_manage_options(int i, char *optarg) { } return 1; case LONG_ARGS_PYTHONPATH: - if (up.python_path_cnt < MAX_PYTHONPATH) { - up.python_path[up.python_path_cnt] = optarg; - up.python_path_cnt++; - } - else { - uwsgi_log("you can specify at most %d --pythonpath options\n", MAX_PYTHONPATH); - } + uwsgi_string_new_list(&up.python_path, optarg); return 1; case LONG_ARGS_PYARGV: up.argv = optarg; diff --git a/plugins/python/uwsgi_python.h b/plugins/python/uwsgi_python.h index 59519f24..974535dc 100644 --- a/plugins/python/uwsgi_python.h +++ b/plugins/python/uwsgi_python.h @@ -3,7 +3,6 @@ #include -#define MAX_PYTHONPATH 64 #define MAX_PYMODULE_ALIAS 64 #define MAX_PYARGV 10 @@ -91,8 +90,7 @@ struct uwsgi_python { char *test_module; - char *python_path[MAX_PYTHONPATH]; - int python_path_cnt; + struct uwsgi_string_list *python_path; PyObject *loader_dict; PyObject* (*loaders[LOADER_MAX]) (void *);