Author: neal.norwitz
Date: Sat Oct 27 07:40:06 2007
New Revision: 58686
Modified:
python/branches/py3k/Modules/_localemodule.c
python/branches/py3k/Modules/pwdmodule.c
Log:
Get the locale and pwd tests working on the Solaris box where there
are some unicode values used. I'm not sure if this is the correct
on all operating systems, but this works on Linux w/o unicode.
Modified: python/branches/py3k/Modules/_localemodule.c
==============================================================================
--- python/branches/py3k/Modules/_localemodule.c (original)
+++ python/branches/py3k/Modules/_localemodule.c Sat Oct 27 07:40:06 2007
@@ -143,7 +143,7 @@
involved herein */
#define RESULT_STRING(s)\
- x = PyUnicode_FromString(l->s);\
+ x = PyUnicode_DecodeUnicodeEscape(l->s, strlen(l->s), "strict");\
if (!x) goto failed;\
PyDict_SetItemString(result, #s, x);\
Py_XDECREF(x)
@@ -471,8 +471,10 @@
/* Check NULL as a workaround for GNU libc's returning NULL
instead of an empty string for nl_langinfo(ERA). */
const char *result = nl_langinfo(item);
+ result = result != NULL ? result : "";
/* XXX may have to convert this to wcs first. */
- return PyUnicode_FromString(result != NULL ? result : "");
+ return PyUnicode_DecodeUnicodeEscape(result, strlen(result),
+ "strict");
}
PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
return NULL;
Modified: python/branches/py3k/Modules/pwdmodule.c
==============================================================================
--- python/branches/py3k/Modules/pwdmodule.c (original)
+++ python/branches/py3k/Modules/pwdmodule.c Sat Oct 27 07:40:06 2007
@@ -48,8 +48,11 @@
static void
sets(PyObject *v, int i, const char* val)
{
- if (val)
- PyStructSequence_SET_ITEM(v, i, PyUnicode_FromString(val));
+ if (val) {
+ PyObject *o =
+ PyUnicode_DecodeUnicodeEscape(val, strlen(val), "strict");
+ PyStructSequence_SET_ITEM(v, i, o);
+ }
else {
PyStructSequence_SET_ITEM(v, i, Py_None);
Py_INCREF(Py_None);
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins