summaryrefslogtreecommitdiffstats
path: root/Modules/pwdmodule.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/pwdmodule.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/pwdmodule.c')
-rw-r--r--Modules/pwdmodule.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index 35a387a..b303f95 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -132,9 +132,7 @@ pwd_getpwnam(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "U:getpwnam", &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;