diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/grpmodule.c | 9 | ||||
-rw-r--r-- | Modules/posixmodule.c | 2 | ||||
-rw-r--r-- | Modules/pwdmodule.c | 2 | ||||
-rw-r--r-- | Modules/spwdmodule.c | 4 |
4 files changed, 6 insertions, 11 deletions
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 0dcef06..912d139 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -46,11 +46,8 @@ mkgrent(struct group *p) Py_DECREF(v); return NULL; } -#define FSDECODE(val) PyUnicode_Decode(val, strlen(val),\ - Py_FileSystemDefaultEncoding,\ - "surrogateescape") for (member = p->gr_mem; *member != NULL; member++) { - PyObject *x = FSDECODE(*member); + PyObject *x = PyUnicode_DecodeFSDefault(*member); if (x == NULL || PyList_Append(w, x) != 0) { Py_XDECREF(x); Py_DECREF(w); @@ -61,13 +58,13 @@ mkgrent(struct group *p) } #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) - SET(setIndex++, FSDECODE(p->gr_name)); + SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_name)); #ifdef __VMS SET(setIndex++, Py_None); Py_INCREF(Py_None); #else if (p->gr_passwd) - SET(setIndex++, FSDECODE(p->gr_passwd)); + SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_passwd)); else { SET(setIndex++, Py_None); Py_INCREF(Py_None); diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0d6f8f0..a48f233 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2031,7 +2031,7 @@ posix_getcwd(int use_bytes) return posix_error(); if (use_bytes) return PyBytes_FromStringAndSize(buf, strlen(buf)); - return PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,"surrogateescape"); + return PyUnicode_DecodeFSDefault(buf); } PyDoc_STRVAR(posix_getcwd__doc__, diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 1547cdf..827fa43 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -49,7 +49,7 @@ static void sets(PyObject *v, int i, const char* val) { if (val) { - PyObject *o = PyUnicode_Decode(val, strlen(val), + PyObject *o = PyUnicode_DecodeFSDefault(val, strlen(val), Py_FileSystemDefaultEncoding, "surrogateescape"); PyStructSequence_SET_ITEM(v, i, o); diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c index 230b57c..422ab03 100644 --- a/Modules/spwdmodule.c +++ b/Modules/spwdmodule.c @@ -60,9 +60,7 @@ static void sets(PyObject *v, int i, const char* val) { if (val) { - PyObject *o = PyUnicode_Decode(val, strlen(val), - Py_FileSystemDefaultEncoding, - "surrogateescape"); + PyObject *o = PyUnicode_DecodeFSDefault(val); PyStructSequence_SET_ITEM(v, i, o); } else { PyStructSequence_SET_ITEM(v, i, Py_None); |