summaryrefslogtreecommitdiff
path: root/src/server/wsgi_interp.c
diff options
context:
space:
mode:
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>2014-09-15 08:00:29 +1000
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>2014-09-15 08:00:29 +1000
commit1242f836f8fbcbf9abc674c30774d4377fa09154 (patch)
treefc40bddaa699f4baa673550fbb4964858d35b4f4 /src/server/wsgi_interp.c
parentcc3c0395d551bfc9a54de56d0120d87ac53fb5d7 (diff)
parentef1117a85e84c70cac03e829a8c133c74184cc62 (diff)
downloadmod_wsgi-4.3.0.tar.gz
Merge branch 'release/4.3.0'4.3.0
Diffstat (limited to 'src/server/wsgi_interp.c')
-rw-r--r--src/server/wsgi_interp.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/server/wsgi_interp.c b/src/server/wsgi_interp.c
index 98f011c..6d8e765 100644
--- a/src/server/wsgi_interp.c
+++ b/src/server/wsgi_interp.c
@@ -907,29 +907,30 @@ InterpreterObject *newInterpreterObject(const char *name)
/*
* If running in daemon mode and a home directory was set then
- * insert an empty string at the start of the Python module search
- * path so the current working directory will be searched. This
- * makes things similar to when using the Python interpreter on the
- * command line. If the current working directory changes then where
- * it looks follows, so doesn't always look in home.
+ * insert the home directory at the start of the Python module
+ * search path. This makes things similar to when using the Python
+ * interpreter on the command line with a script.
*/
#if defined(MOD_WSGI_WITH_DAEMONS)
if (wsgi_daemon_process && wsgi_daemon_process->group->home) {
PyObject *path = NULL;
+ const char *home = wsgi_daemon_process->group->home;
path = PySys_GetObject("path");
if (module && path) {
- PyObject *empty;
+ PyObject *item;
#if PY_MAJOR_VERSION >= 3
- empty = PyUnicode_DecodeLatin1("", strlen(""), NULL);
+ item = PyUnicode_Decode(home, strlen(home),
+ Py_FileSystemDefaultEncoding,
+ "surrogateescape");
#else
- empty = PyString_FromString("");
+ item = PyString_FromString(home);
#endif
- PyList_Insert(path, 0, empty);
- Py_DECREF(empty);
+ PyList_Insert(path, 0, item);
+ Py_DECREF(item);
}
Py_XDECREF(module);