Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 53767:ac209f132b17
Issue #5915: Implement PEP 383, Non-decodable Bytes in
System Character Interfaces.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Tue, 05 May 2009 04:43:17 +0000 |
| parents | 73a7e6aba7b2 |
| children | 3416721480b2 |
line wrap: on
line diff
--- a/Python/pythonrun.c Tue May 05 02:22:38 2009 +0000 +++ b/Python/pythonrun.c Tue May 05 04:43:17 2009 +0000 @@ -262,6 +262,22 @@ _PyImportHooks_Init(); +#if defined(HAVE_LANGINFO_H) && defined(CODESET) + /* On Unix, set the file system encoding according to the + user's preference, if the CODESET names a well-known + Python codec, and Py_FileSystemDefaultEncoding isn't + initialized by other means. Also set the encoding of + stdin and stdout if these are terminals. */ + + codeset = get_codeset(); + if (codeset) { + if (!Py_FileSystemDefaultEncoding) + Py_FileSystemDefaultEncoding = codeset; + else + free(codeset); + } +#endif + if (install_sigs) initsigs(); /* Signal handling stuff, including initintr() */ @@ -285,22 +301,6 @@ #ifdef WITH_THREAD _PyGILState_Init(interp, tstate); #endif /* WITH_THREAD */ - -#if defined(HAVE_LANGINFO_H) && defined(CODESET) - /* On Unix, set the file system encoding according to the - user's preference, if the CODESET names a well-known - Python codec, and Py_FileSystemDefaultEncoding isn't - initialized by other means. Also set the encoding of - stdin and stdout if these are terminals. */ - - codeset = get_codeset(); - if (codeset) { - if (!Py_FileSystemDefaultEncoding) - Py_FileSystemDefaultEncoding = codeset; - else - free(codeset); - } -#endif } void
