summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>2012-04-15 15:00:36 +1000
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>2012-04-15 15:00:36 +1000
commit4e5f57c5242f62c28be667c760142690586df9c4 (patch)
treedccf23e8c1b21b7209fae00e74ccdaeebcb2cce6
parentf1949a5a2023fe8c6934edf860ad9287ac1e4faa (diff)
downloadmod_wsgi-4e5f57c5242f62c28be667c760142690586df9c4.tar.gz
Workaround problem in Python where it doesn't initialise codecs automatically for sub interpreters.
-rw-r--r--mod_wsgi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mod_wsgi.c b/mod_wsgi.c
index d66e1dd..62e9b1a 100644
--- a/mod_wsgi.c
+++ b/mod_wsgi.c
@@ -4600,6 +4600,17 @@ static InterpreterObject *newInterpreterObject(const char *name)
}
/*
+ * Force loading of codecs into interpreter. This has to be
+ * done as not otherwise done in sub interpreters and if not
+ * done, code running in sub interpreters can fail on some
+ * platforms if a unicode string is added in sys.path and an
+ * import then done.
+ */
+
+ item = PyCodec_Encoder("ascii");
+ Py_XDECREF(item);
+
+ /*
* If running in daemon process, override as appropriate
* the USER, USERNAME or LOGNAME environment variables
* so that they match the user that the process is running