Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 49403:e822992cf6ce
Issue #3187: Add sys.setfilesystemencoding.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Fri, 03 Oct 2008 16:09:28 +0000 |
| parents | de0bf60f1245 |
| children | cbc3afc1e40a |
line wrap: on
line diff
--- a/Python/sysmodule.c Thu Oct 02 21:02:27 2008 +0000 +++ b/Python/sysmodule.c Fri Oct 03 16:09:28 2008 +0000 @@ -216,7 +216,24 @@ operating system filenames." ); +static PyObject * +sys_setfilesystemencoding(PyObject *self, PyObject *args) +{ + PyObject *new_encoding; + if (!PyArg_ParseTuple(args, "U:setfilesystemencoding", &new_encoding)) + return NULL; + if (_Py_SetFileSystemEncoding(new_encoding)) + return NULL; + Py_INCREF(Py_None); + return Py_None; +} +PyDoc_STRVAR(setfilesystemencoding_doc, +"setfilesystemencoding(string) -> None\n\ +\n\ +Set the encoding used to convert Unicode filenames in\n\ +operating system filenames." +); static PyObject * sys_intern(PyObject *self, PyObject *args) @@ -872,6 +889,8 @@ #endif {"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS, setdefaultencoding_doc}, + {"setfilesystemencoding", sys_setfilesystemencoding, METH_VARARGS, + setfilesystemencoding_doc}, {"setcheckinterval", sys_setcheckinterval, METH_VARARGS, setcheckinterval_doc}, {"getcheckinterval", sys_getcheckinterval, METH_NOARGS,
