summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-10-30 21:48:26 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-10-30 21:48:26 (GMT)
commit6a27efa2d321c2b262c0cab3c2d4af3e2e8a9ead (patch)
tree8b5388600b6df266a89b8ec1324ae6441cfbd032 /Objects
parent5833a2f6fdc6ee58b23a02380093bf1bfb015f3c (diff)
downloadcpython-6a27efa2d321c2b262c0cab3c2d4af3e2e8a9ead.zip
cpython-6a27efa2d321c2b262c0cab3c2d4af3e2e8a9ead.tar.gz
cpython-6a27efa2d321c2b262c0cab3c2d4af3e2e8a9ead.tar.bz2
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')
-rw-r--r--Objects/unicodeobject.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ecd44cb..2beb098 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 */