add another fix for unicode support in python3.3

Signed-off-by: Thomas Spura <thomas.spura@gmail.com>
This commit is contained in:
Thomas Spura 2012-08-05 15:24:42 +02:00
parent bfb60341ae
commit 9aa5fccb8b
2 changed files with 17 additions and 0 deletions

View File

@ -52,3 +52,19 @@
else {
PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj;
vobj->base = NULL;
diff --git numpy/core/src/multiarray/scalartypes.c.src numpy/core/src/multiarray/scalartypes.c.src
index e547071..12745d7 100644
--- numpy/core/src/multiarray/scalartypes.c.src
+++ numpy/core/src/multiarray/scalartypes.c.src
@@ -2592,7 +2592,11 @@ finish:
*((npy_@name@ *)dest) = *((npy_@name@ *)src);
#elif @default@ == 1 /* unicode and strings */
if (itemsize == 0) { /* unicode */
+#if PY_VERSION_HEX >= 0x03030000
+ itemsize = PyUnicode_GetLength(robj) * PyUnicode_KIND(robj);
+#else
itemsize = ((PyUnicodeObject *)robj)->length * sizeof(Py_UNICODE);
+#endif
}
memcpy(dest, src, itemsize);
/* @default@ == 2 won't get here */

View File

@ -23,6 +23,7 @@ Source0: http://downloads.sourceforge.net/numpy/%{name}-%{version}%{?relc
# Merge: fd15162 f2ac38f
# Author: Travis E. Oliphant <teoliphant@gmail.com>
# Date: Fri Aug 3 22:46:21 2012 -0700
# and commit a9d58ab42da8d2ed9071044848a54c5e066b557a
Patch0: numpy-1.6.2-unicode-python3.3.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)