diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2009-05-05 04:43:17 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2009-05-05 04:43:17 +0000 |
commit | 032767018d78e6e0fe3136110e43f85d8df53290 (patch) | |
tree | cbde219181e89bacedae751572f1f9b43546e2e0 /Python/pythonrun.c | |
parent | 994b2b59666ac255f43d7d8069711001ded59c7f (diff) | |
download | cpython-032767018d78e6e0fe3136110e43f85d8df53290.tar.gz |
Issue #5915: Implement PEP 383, Non-decodable Bytes in
System Character Interfaces.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index f93403ba5a..c75f55fe9a 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -262,6 +262,22 @@ Py_InitializeEx(int install_sigs) _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 @@ Py_InitializeEx(int install_sigs) #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 |