mirror of
https://github.com/python/cpython.git
synced 2025-09-01 06:28:36 +00:00
Issue #3187: Add sys.setfilesystemencoding.
This commit is contained in:
parent
efb14a8857
commit
04dc25c537
6 changed files with 58 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue