diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-15 16:27:27 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-15 16:27:27 (GMT) |
commit | ae6265f8d06dbec7d08c73ca23dad0f040d09b8e (patch) | |
tree | 3598426233e690b284bce322194f51be94ab6799 /Modules/_io | |
parent | 59e62db0a39eb89930ed3ae1730726cd15b7d640 (diff) | |
download | cpython-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/_io')
-rw-r--r-- | Modules/_io/fileio.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index 6ecce1b..4f450da 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -247,8 +247,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) if (u == NULL) return -1; - stringobj = PyUnicode_AsEncodedString( - u, Py_FileSystemDefaultEncoding, "surrogateescape"); + stringobj = PyUnicode_EncodeFSDefault(u); Py_DECREF(u); if (stringobj == NULL) return -1; |