Message134421
> I think that Python used interp->codecs_initialized flag
Yes in PyUnicode_AsEncodedString(), in Python 3.0 and 3.1. Python 3.2 has also the test, but PyUnicode_AsEncodedString() is no more used to encode filenames. I removed the test in Python 3.3.
Extract of Python 3.1:
/* 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);
I implemented the "XXX could try wcstombs" part, but in new functions: PyUnicode_EncodeFSDefault and PyUnicode_DecodeFSDefaultAndSize. |
|
Date |
User |
Action |
Args |
2011-04-25 21:51:09 | vstinner | set | recipients:
+ vstinner, loewis, amaury.forgeotdarc, ncoghlan, pitrou, christian.heimes, benjamin.peterson, tarek, eric.araujo, grahamd, python-dev |
2011-04-25 21:51:09 | vstinner | set | messageid: <1303768269.04.0.928915307898.issue10914@psf.upfronthosting.co.za> |
2011-04-25 21:51:08 | vstinner | link | issue10914 messages |
2011-04-25 21:51:08 | vstinner | create | |
|