summaryrefslogtreecommitdiffstats
path: root/Modules/grpmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-07 16:34:53 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-07 16:34:53 (GMT)
commit97c18ab6a52774364511bb5e4bf0444af4e700b9 (patch)
tree5e14ba30e2d38f4813d027b4a391460d8fdfcc85 /Modules/grpmodule.c
parent56fdb7545363c5b1e2987b08fa9b271dd289ce66 (diff)
downloadcpython-97c18ab6a52774364511bb5e4bf0444af4e700b9.zip
cpython-97c18ab6a52774364511bb5e4bf0444af4e700b9.tar.gz
cpython-97c18ab6a52774364511bb5e4bf0444af4e700b9.tar.bz2
Replace PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,
"surrogateescape") by PyUnicode_DecodeFSDefault(val).
Diffstat (limited to 'Modules/grpmodule.c')
-rw-r--r--Modules/grpmodule.c9
1 files changed, 3 insertions, 6 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);