File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ PyLocale_localeconv(PyObject* self)
143143 involved herein */
144144
145145#define RESULT_STRING (s )\
146- x = PyUnicode_FromString (l->s);\
146+ x = PyUnicode_DecodeUnicodeEscape (l->s, strlen(l->s), "strict" );\
147147 if (!x) goto failed;\
148148 PyDict_SetItemString(result, #s, x);\
149149 Py_XDECREF(x)
@@ -471,8 +471,10 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
471471 /* Check NULL as a workaround for GNU libc's returning NULL
472472 instead of an empty string for nl_langinfo(ERA). */
473473 const char * result = nl_langinfo (item );
474+ result = result != NULL ? result : "" ;
474475 /* XXX may have to convert this to wcs first. */
475- return PyUnicode_FromString (result != NULL ? result : "" );
476+ return PyUnicode_DecodeUnicodeEscape (result , strlen (result ),
477+ "strict" );
476478 }
477479 PyErr_SetString (PyExc_ValueError , "unsupported langinfo constant" );
478480 return NULL ;
Original file line number Diff line number Diff line change @@ -48,8 +48,11 @@ static PyTypeObject StructPwdType;
4848static void
4949sets (PyObject * v , int i , const char * val )
5050{
51- if (val )
52- PyStructSequence_SET_ITEM (v , i , PyUnicode_FromString (val ));
51+ if (val ) {
52+ PyObject * o =
53+ PyUnicode_DecodeUnicodeEscape (val , strlen (val ), "strict" );
54+ PyStructSequence_SET_ITEM (v , i , o );
55+ }
5356 else {
5457 PyStructSequence_SET_ITEM (v , i , Py_None );
5558 Py_INCREF (Py_None );
You can’t perform that action at this time.
0 commit comments