diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-03-05 15:13:47 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-03-05 15:13:47 (GMT) |
commit | 73d538b9c6d2f262a7d615248c84e509ebd64731 (patch) | |
tree | 777d023ce5bb75fa1831d4815533fd085a62b0b7 /Modules/_localemodule.c | |
parent | 620c0837bd4bcc7253cf402c553a50f64e5b9619 (diff) | |
download | cpython-73d538b9c6d2f262a7d615248c84e509ebd64731.zip cpython-73d538b9c6d2f262a7d615248c84e509ebd64731.tar.gz cpython-73d538b9c6d2f262a7d615248c84e509ebd64731.tar.bz2 |
Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize,
and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding.
Adjust test case.
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 2077be8..840f838 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -161,10 +161,6 @@ fixup_ulcase(void) Py_DECREF(ulo); } -#if defined(HAVE_LANGINFO_H) && defined(CODESET) -static int fileencoding_uses_locale = 0; -#endif - static PyObject* PyLocale_setlocale(PyObject* self, PyObject* args) { @@ -213,22 +209,6 @@ PyLocale_setlocale(PyObject* self, PyObject* args) fixup_ulcase(); /* things that got wrong up to here are ignored */ PyErr_Clear(); -#if defined(HAVE_LANGINFO_H) && defined(CODESET) - if (Py_FileSystemDefaultEncoding == NULL) - fileencoding_uses_locale = 1; - if (fileencoding_uses_locale) { - char *codeset = nl_langinfo(CODESET); - PyObject *enc = NULL; - if (*codeset && (enc = PyCodec_Encoder(codeset))) { - /* Release previous file encoding */ - if (Py_FileSystemDefaultEncoding) - free((char *)Py_FileSystemDefaultEncoding); - Py_FileSystemDefaultEncoding = strdup(codeset); - Py_DECREF(enc); - } else - PyErr_Clear(); - } -#endif } else { /* get locale */ /* restore LC_NUMERIC first, if appropriate */ |