summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-10-30 21:48:26 +0000
committerChristian Heimes <christian@cheimes.de>2008-10-30 21:48:26 +0000
commit6a27efa2d321c2b262c0cab3c2d4af3e2e8a9ead (patch)
tree8b5388600b6df266a89b8ec1324ae6441cfbd032 /Objects/unicodeobject.c
parent5833a2f6fdc6ee58b23a02380093bf1bfb015f3c (diff)
downloadcpython-git-6a27efa2d321c2b262c0cab3c2d4af3e2e8a9ead.tar.gz
Issue 3723: Fixed initialization of subinterpreters
The patch fixes several issues with Py_NewInterpreter as well as the demo for multiple subinterpreters. Most of the patch was written by MvL with help from Benjamin, Amaury and me. Graham Dumpleton has verified that this patch fixes an issue with mod_wsgi.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ecd44cb788..2beb0984b4 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1346,6 +1346,19 @@ PyObject *PyUnicode_AsEncodedString(PyObject *unicode,
#endif
else if (strcmp(encoding, "ascii") == 0)
return PyUnicode_AsASCIIString(unicode);
+ /* During bootstrap, we may need to find the encodings
+ package, to load the file system encoding, and require the
+ file system encoding in order to load the encodings
+ package.
+
+ Break out of this dependency by assuming that the path to
+ the encodings module is ASCII-only. XXX could try wcstombs
+ instead, if the file system encoding is the locale's
+ encoding. */
+ else if (Py_FileSystemDefaultEncoding &&
+ strcmp(encoding, Py_FileSystemDefaultEncoding) == 0 &&
+ !PyThreadState_GET()->interp->codecs_initialized)
+ return PyUnicode_AsASCIIString(unicode);
}
/* Encode via the codec registry */