summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-03-05 15:13:47 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-03-05 15:13:47 (GMT)
commit73d538b9c6d2f262a7d615248c84e509ebd64731 (patch)
tree777d023ce5bb75fa1831d4815533fd085a62b0b7 /Modules/_localemodule.c
parent620c0837bd4bcc7253cf402c553a50f64e5b9619 (diff)
downloadcpython-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.c20
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 */