Commit cb3ae55
authored
1 parent 3948207 commit cb3ae55
File tree
4 files changed
+17
-8
lines changed- Include
- Modules
- Objects
4 files changed
+17-8lines changed+4Original file line number Diff line number Diff line change @@ -1811,6 +1811,10 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale(1811
1811
const char *errors1812
1812
);1813
1813
1814
+
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeCurrentLocale(1815
+
const char *str,1816
+
const char *errors);1817
+
1814
1818
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeCurrentLocaleAndSize(1815
1819
const char *str,1816
1820
Py_ssize_t len,+1-2Original file line number Diff line number Diff line change @@ -138,8 +138,7 @@ encode(PyObject *b)138
138
static PyObject *139
139
decode(const char *s)140
140
{141
-
return _PyUnicode_DecodeCurrentLocaleAndSize(s, strlen(s),142
-
"surrogateescape");141
+
return _PyUnicode_DecodeCurrentLocale(s, "surrogateescape");143
142
}144
143
145
144
+6-6Original file line number Diff line number Diff line change @@ -418,11 +418,11 @@ tmtotuple(struct tm *p418
418
SET(8, p->tm_isdst);419
419
#ifdef HAVE_STRUCT_TM_TM_ZONE420
420
PyStructSequence_SET_ITEM(v, 9,421
-
PyUnicode_DecodeLocale(p->tm_zone, "surrogateescape"));421
+
_PyUnicode_DecodeCurrentLocale(p->tm_zone, "surrogateescape"));422
422
SET(10, p->tm_gmtoff);423
423
#else424
424
PyStructSequence_SET_ITEM(v, 9,425
-
PyUnicode_DecodeLocale(zone, "surrogateescape"));425
+
_PyUnicode_DecodeCurrentLocale(zone, "surrogateescape"));426
426
PyStructSequence_SET_ITEM(v, 10, _PyLong_FromTime_t(gmtoff));427
427
#endif /* HAVE_STRUCT_TM_TM_ZONE */428
428
#undef SET@@ -809,8 +809,8 @@ time_strftime(PyObject *self, PyObject *args)809
809
#ifdef HAVE_WCSFTIME810
810
ret = PyUnicode_FromWideChar(outbuf, buflen);811
811
#else812
-
ret = PyUnicode_DecodeLocaleAndSize(outbuf, buflen,813
-
"surrogateescape");812
+
ret = _PyUnicode_DecodeCurrentLocaleAndSize(outbuf, buflen,813
+
"surrogateescape");814
814
#endif815
815
PyMem_Free(outbuf);816
816
break;@@ -1541,8 +1541,8 @@ PyInit_timezone(PyObject *m) {1541
1541
PyModule_AddIntConstant(m, "altzone", timezone-3600);1542
1542
#endif1543
1543
PyModule_AddIntConstant(m, "daylight", daylight);1544
-
otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape");1545
-
otz1 = PyUnicode_DecodeLocale(tzname[1], "surrogateescape");1544
+
otz0 = _PyUnicode_DecodeCurrentLocale(tzname[0], "surrogateescape");1545
+
otz1 = _PyUnicode_DecodeCurrentLocale(tzname[1], "surrogateescape");1546
1546
PyModule_AddObject(m, "tzname", Py_BuildValue("(NN)", otz0, otz1));1547
1547
#else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/1548
1548
{+6Original file line number Diff line number Diff line change @@ -3836,6 +3836,12 @@ _PyUnicode_DecodeCurrentLocaleAndSize(const char *str, Py_ssize_t len,3836
3836
return unicode_decode_locale(str, len, errors, 1);3837
3837
}3838
3838
3839
+
PyObject*3840
+
_PyUnicode_DecodeCurrentLocale(const char *str, const char *errors)3841
+
{3842
+
return unicode_decode_locale(str, (Py_ssize_t)strlen(str), errors, 1);3843
+
}3844
+
3839
3845
PyObject*3840
3846
PyUnicode_DecodeLocale(const char *str, const char *errors)3841
3847
{
0 commit comments