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/timemodule.c | |
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/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 9 |
1 files changed, 5 insertions, 4 deletions
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 |