Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 28174:3f90d21debe9 legacy-trunk
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.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 05 Mar 2003 15:13:47 +0000 |
| parents | 869695cba2cd |
| children | 78395e5b4782 |
line wrap: on
line diff
--- a/Python/sysmodule.c Wed Mar 05 14:44:54 2003 +0000 +++ b/Python/sysmodule.c Wed Mar 05 15:13:47 2003 +0000 @@ -236,6 +236,22 @@ Set the current default string encoding used by the Unicode implementation." ); +static PyObject * +sys_getfilesystemencoding(PyObject *self) +{ + if (Py_FileSystemDefaultEncoding) + return PyString_FromString(Py_FileSystemDefaultEncoding); + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(getfilesystemencoding_doc, +"getfilesystemencoding() -> string\n\ +\n\ +Return the encoding used to convert Unicode filenames in\n\ +operating system filenames." +); + #endif /* @@ -649,6 +665,10 @@ #ifdef DYNAMIC_EXECUTION_PROFILE {"getdxp", _Py_GetDXProfile, METH_VARARGS}, #endif +#ifdef Py_USING_UNICODE + {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, + METH_NOARGS, getfilesystemencoding_doc}, +#endif #ifdef Py_TRACE_REFS {"getobjects", _Py_GetObjects, METH_VARARGS}, #endif
