comparison Python/pythonrun.c @ 65265:a75fd31ddabb

Issue #9992: Remove PYTHONFSENCODING environment variable.
author Victor Stinner <victor.stinner@haypocalc.com>
date Wed, 13 Oct 2010 22:02:27 +0000
parents 01b96f78fb70
children f63d747622bd
comparison
equal deleted inserted replaced
65264:1960f58af785 65265:a75fd31ddabb
978 PyObject *codec; 978 PyObject *codec;
979 #if defined(HAVE_LANGINFO_H) && defined(CODESET) 979 #if defined(HAVE_LANGINFO_H) && defined(CODESET)
980 char *codeset = NULL; 980 char *codeset = NULL;
981 981
982 if (Py_FileSystemDefaultEncoding == NULL) { 982 if (Py_FileSystemDefaultEncoding == NULL) {
983 const char *env_encoding = Py_GETENV("PYTHONFSENCODING"); 983 /* On Unix, set the file system encoding according to the
984 if (env_encoding != NULL) { 984 user's preference, if the CODESET names a well-known
985 codeset = get_codec_name(env_encoding); 985 Python codec, and Py_FileSystemDefaultEncoding isn't
986 if (!codeset) { 986 initialized by other means. Also set the encoding of
987 fprintf(stderr, "PYTHONFSENCODING is not a valid encoding:\n"); 987 stdin and stdout if these are terminals. */
988 PyErr_Print(); 988 codeset = get_codeset();
989 }
990 }
991 if (!codeset) {
992 /* On Unix, set the file system encoding according to the
993 user's preference, if the CODESET names a well-known
994 Python codec, and Py_FileSystemDefaultEncoding isn't
995 initialized by other means. Also set the encoding of
996 stdin and stdout if these are terminals. */
997 codeset = get_codeset();
998 }
999 if (codeset != NULL) { 989 if (codeset != NULL) {
1000 if (redecode_filenames(codeset)) 990 if (redecode_filenames(codeset))
1001 Py_FatalError("Py_Initialize: can't redecode filenames"); 991 Py_FatalError("Py_Initialize: can't redecode filenames");
1002 Py_FileSystemDefaultEncoding = codeset; 992 Py_FileSystemDefaultEncoding = codeset;
1003 Py_HasFileSystemDefaultEncoding = 0; 993 Py_HasFileSystemDefaultEncoding = 0;