summaryrefslogtreecommitdiffstats
path: root/Modules/grpmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-15 16:27:27 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-15 16:27:27 (GMT)
commitae6265f8d06dbec7d08c73ca23dad0f040d09b8e (patch)
tree3598426233e690b284bce322194f51be94ab6799 /Modules/grpmodule.c
parent59e62db0a39eb89930ed3ae1730726cd15b7d640 (diff)
downloadcpython-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.zip
cpython-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.tar.gz
cpython-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.tar.bz2
Issue #8715: Create PyUnicode_EncodeFSDefault() function: Encode a Unicode
object to Py_FileSystemDefaultEncoding with the "surrogateescape" error handler, return a bytes object. If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8.
Diffstat (limited to 'Modules/grpmodule.c')
-rw-r--r--Modules/grpmodule.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index d10a79d..d64c142 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -111,8 +111,7 @@ grp_getgrnam(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "U:getgrnam", &arg))
return NULL;
- if ((bytes = PyUnicode_AsEncodedString(arg, Py_FileSystemDefaultEncoding,
- "surrogateescape")) == NULL)
+ if ((bytes = PyUnicode_EncodeFSDefault(arg)) == NULL)
return NULL;
if (PyBytes_AsStringAndSize(bytes, &name, NULL) == -1)
goto out;