Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
python3-numpy
numpy-python33.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File numpy-python33.patch of Package python3-numpy
Index: numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c =================================================================== --- numpy-1.6.2.orig/numpy/core/src/multiarray/scalarapi.c +++ numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c @@ -652,6 +652,34 @@ PyArray_Scalar(void *data, PyArray_Descr itemsize = (((itemsize - 1) >> 2) + 1) << 2; } } +#if PY_VERSION_HEX >= 0x03030000 + if (type_num == NPY_UNICODE) { + PyObject *u, *args; + int byteorder; +#if NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN + byteorder = -1; +#elif NPY_BYTE_ORDER == NPY_BIG_ENDIAN + byteorder = +1; +#else + #error Endianness undefined ? +#endif + if (swap) byteorder *= -1; + + u = PyUnicode_DecodeUTF32(data, itemsize, NULL, &byteorder); + if (u == NULL) { + return NULL; + } + args = Py_BuildValue("(O)", u); + if (args == NULL) { + Py_DECREF(u); + return NULL; + } + obj = type->tp_new(type, args, NULL); + Py_DECREF(u); + Py_DECREF(args); + return obj; + } +#endif if (type->tp_itemsize != 0) { /* String type */ obj = type->tp_alloc(type, itemsize); @@ -688,6 +716,7 @@ PyArray_Scalar(void *data, PyArray_Descr memcpy(destptr, data, itemsize); return obj; } +#if PY_VERSION_HEX < 0x0303000 else if (type_num == PyArray_UNICODE) { /* tp_alloc inherited from Python PyBaseObject_Type */ PyUnicodeObject *uni = (PyUnicodeObject*)obj; @@ -759,6 +788,7 @@ PyArray_Scalar(void *data, PyArray_Descr #endif return obj; } +#endif // PY_VERSION_HEX < 0x03030000 else { PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj; vobj->base = NULL; Index: numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src =================================================================== --- numpy-1.6.2.orig/numpy/core/src/multiarray/scalartypes.c.src +++ numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src @@ -2323,7 +2323,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 */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor