summaryrefslogtreecommitdiff
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorDaniel Stutzbach <daniel@stutzbachenterprises.com>2010-08-24 21:57:33 +0000
committerDaniel Stutzbach <daniel@stutzbachenterprises.com>2010-08-24 21:57:33 +0000
commit8b4800c8a891a3954f91ebb91c7caf06ea266074 (patch)
tree6457d00e164ad052f8e289c09ef41b6a9bdb292e /Modules/_localemodule.c
parent4ae66708bae94c3c7b38082e7035f840a4921a4c (diff)
downloadcpython-8b4800c8a891a3954f91ebb91c7caf06ea266074.tar.gz
Issue 8781: On systems a signed 4-byte wchar_t and a 4-byte Py_UNICODE, use memcpy to convert between the two (as already done when wchar_t is unsigned)
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 88f6addd44..2394206823 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -289,15 +289,15 @@ PyLocale_strxfrm(PyObject* self, PyObject* args)
wchar_t *s, *buf = NULL;
size_t n1, n2;
PyObject *result = NULL;
-#ifndef HAVE_USABLE_WCHAR_T
+#if Py_UNICODE_SIZE != SIZEOF_WCHAR_T
Py_ssize_t i;
#endif
if (!PyArg_ParseTuple(args, "u#:strxfrm", &s0, &n0))
return NULL;
-#ifdef HAVE_USABLE_WCHAR_T
- s = s0;
+#if Py_UNICODE_SIZE == SIZEOF_WCHAR_T
+ s = (wchar_t *) s0;
#else
s = PyMem_Malloc((n0+1)*sizeof(wchar_t));
if (!s)
@@ -326,7 +326,7 @@ PyLocale_strxfrm(PyObject* self, PyObject* args)
result = PyUnicode_FromWideChar(buf, n2);
exit:
if (buf) PyMem_Free(buf);
-#ifndef HAVE_USABLE_WCHAR_T
+#if Py_UNICODE_SIZE != SIZEOF_WCHAR_T
PyMem_Free(s);
#endif
return result;