Author vstinner
Recipients amaury.forgeotdarc, benjamin.peterson, christian.heimes, eric.araujo, grahamd, loewis, ncoghlan, pitrou, python-dev, tarek, vstinner
Date 2011-04-25.21:51:08
SpamBayes Score 6.3062e-05
Marked as misclassified No
Message-id <>
> 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

           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 &&
            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:09vstinnersetrecipients: + vstinner, loewis, amaury.forgeotdarc, ncoghlan, pitrou, christian.heimes, benjamin.peterson, tarek, eric.araujo, grahamd, python-dev
2011-04-25 21:51:09vstinnersetmessageid: <>
2011-04-25 21:51:08vstinnerlinkissue10914 messages
2011-04-25 21:51:08vstinnercreate