diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-12-17 04:47:23 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-12-17 04:47:23 (GMT) |
commit | 1b57967b96daeb505e9d2dbe3cd347625dcb0739 (patch) | |
tree | 36cba7b2875396dcaf106fff1fbd862575762744 /Modules | |
parent | ab595943268eebef43e71e2b79e58382c28bca70 (diff) | |
download | cpython-1b57967b96daeb505e9d2dbe3cd347625dcb0739.zip cpython-1b57967b96daeb505e9d2dbe3cd347625dcb0739.tar.gz cpython-1b57967b96daeb505e9d2dbe3cd347625dcb0739.tar.bz2 |
Issue #13560: Locale codec functions use the classic "errors" parameter,
instead of surrogateescape
So it would be possible to support more error handlers later.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/main.c | 2 | ||||
-rw-r--r-- | Modules/posixmodule.c | 2 | ||||
-rw-r--r-- | Modules/timemodule.c | 9 |
3 files changed, 7 insertions, 6 deletions
diff --git a/Modules/main.c b/Modules/main.c index 4899378..d8c5172 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -495,7 +495,7 @@ Py_Main(int argc, wchar_t **argv) /* Use utf-8 on Mac OS X */ unicode = PyUnicode_FromString(p); #else - unicode = PyUnicode_DecodeLocale(p, 1); + unicode = PyUnicode_DecodeLocale(p, "surrogateescape"); #endif if (unicode == NULL) { /* ignore errors */ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6b832c0..acdc00c 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7891,7 +7891,7 @@ posix_strerror(PyObject *self, PyObject *args) "strerror() argument out of range"); return NULL; } - return PyUnicode_DecodeLocale(message, 1); + return PyUnicode_DecodeLocale(message, "surrogateescape"); } diff --git a/Modules/timemodule.c b/Modules/timemodule.c index ad1c54e..ad28e58 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -486,7 +486,7 @@ time_strftime(PyObject *self, PyObject *args) fmt = format; #else /* Convert the unicode string to an ascii one */ - format = PyUnicode_EncodeLocale(format_arg, 1); + format = PyUnicode_EncodeLocale(format_arg, "surrogateescape"); if (format == NULL) return NULL; fmt = PyBytes_AS_STRING(format); @@ -532,7 +532,8 @@ time_strftime(PyObject *self, PyObject *args) #ifdef HAVE_WCSFTIME ret = PyUnicode_FromWideChar(outbuf, buflen); #else - ret = PyUnicode_DecodeLocaleAndSize(outbuf, buflen, 1); + ret = PyUnicode_DecodeLocaleAndSize(outbuf, buflen, + "surrogateescape"); #endif PyMem_Free(outbuf); break; @@ -764,8 +765,8 @@ PyInit_timezone(PyObject *m) { #endif /* PYOS_OS2 */ #endif PyModule_AddIntConstant(m, "daylight", daylight); - otz0 = PyUnicode_DecodeLocale(tzname[0], 1); - otz1 = PyUnicode_DecodeLocale(tzname[1], 1); + otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape"); + otz1 = PyUnicode_DecodeLocale(tzname[1], "surrogateescape"); PyModule_AddObject(m, "tzname", Py_BuildValue("(NN)", otz0, otz1)); #else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ #ifdef HAVE_STRUCT_TM_TM_ZONE |