summaryrefslogtreecommitdiff
path: root/Modules/grpmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-15 16:27:27 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-15 16:27:27 +0000
commitae6265f8d06dbec7d08c73ca23dad0f040d09b8e (patch)
tree3598426233e690b284bce322194f51be94ab6799 /Modules/grpmodule.c
parent59e62db0a39eb89930ed3ae1730726cd15b7d640 (diff)
downloadcpython-git-ae6265f8d06dbec7d08c73ca23dad0f040d09b8e.tar.gz
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 d10a79d800..d64c142857 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;