Replace PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,
"surrogateescape") by PyUnicode_DecodeFSDefault(val).
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 @@
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 @@
}
#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);