diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-10-03 16:09:28 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-10-03 16:09:28 (GMT) |
commit | 04dc25c53728f5c2fe66d9e66af67da0c9b8959d (patch) | |
tree | 89a6a5bfc7567d3f5deba78bd96fedd2e167e2ce /Python/sysmodule.c | |
parent | efb14a8857c57e446477ecb964b301b041527c50 (diff) | |
download | cpython-04dc25c53728f5c2fe66d9e66af67da0c9b8959d.zip cpython-04dc25c53728f5c2fe66d9e66af67da0c9b8959d.tar.gz cpython-04dc25c53728f5c2fe66d9e66af67da0c9b8959d.tar.bz2 |
Issue #3187: Add sys.setfilesystemencoding.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index f4118d6..89f50b5 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -216,7 +216,24 @@ Return the encoding used to convert Unicode filenames in\n\ 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 @@ static PyMethodDef sys_methods[] = { #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, |