Update to 1.7.0b1

Rebase python 3.3 patchs to current git master
Drop patches applied upstream
This commit is contained in:
Orion Poplawski 2012-08-21 16:46:29 -06:00
parent c8ca126fdd
commit f27ccf5465
7 changed files with 39 additions and 136 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ numpy-1.4.1.tar.gz
/numpy-1.6.1.tar.gz
/numpy-1.6.2rc1.tar.gz
/numpy-1.6.2.tar.gz
/numpy-1.7.0b1.tar.gz

View File

@ -1,9 +1,9 @@
diff -up numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray numpy-1.6.2/numpy/core/tests/test_multiarray.py
--- numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray 2012-05-19 09:51:54.000000000 -0400
+++ numpy-1.6.2/numpy/core/tests/test_multiarray.py 2012-08-05 09:36:17.138719006 -0400
@@ -13,6 +13,15 @@ from numpy.compat import asbytes, getexc
diff -up numpy-1.7.0b1/numpy/core/tests/test_multiarray.py.orig numpy-1.7.0b1/numpy/core/tests/test_multiarray.py
--- numpy-1.7.0b1/numpy/core/tests/test_multiarray.py.orig 2012-08-12 21:53:17.000000000 -0600
+++ numpy-1.7.0b1/numpy/core/tests/test_multiarray.py 2012-08-21 16:36:35.123297576 -0600
@@ -23,6 +23,15 @@ from numpy.testing import (
from datetime import timedelta
from test_print import in_foreign_locale
+if sys.version_info[:2] > (3, 2):
+ # In Python 3.3 the representation of empty shape, strides and suboffsets
@ -17,7 +17,7 @@ diff -up numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray numpy-1
class TestFlags(TestCase):
def setUp(self):
self.a = arange(10)
@@ -2162,7 +2171,7 @@ if sys.version_info >= (2, 6):
@@ -2640,7 +2649,7 @@ if sys.version_info >= (2, 6):
assert_equal(y.shape, (5,))
assert_equal(y.ndim, 1)
assert_equal(y.strides, (4,))
@ -26,7 +26,7 @@ diff -up numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray numpy-1
assert_equal(y.itemsize, 4)
def test_export_simple_nd(self):
@@ -2172,7 +2181,7 @@ if sys.version_info >= (2, 6):
@@ -2650,7 +2659,7 @@ if sys.version_info >= (2, 6):
assert_equal(y.shape, (2, 2))
assert_equal(y.ndim, 2)
assert_equal(y.strides, (16, 8))
@ -35,7 +35,7 @@ diff -up numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray numpy-1
assert_equal(y.itemsize, 8)
def test_export_discontiguous(self):
@@ -2182,7 +2191,7 @@ if sys.version_info >= (2, 6):
@@ -2660,7 +2669,7 @@ if sys.version_info >= (2, 6):
assert_equal(y.shape, (3, 3))
assert_equal(y.ndim, 2)
assert_equal(y.strides, (36, 4))
@ -44,7 +44,7 @@ diff -up numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray numpy-1
assert_equal(y.itemsize, 4)
def test_export_record(self):
@@ -2214,7 +2223,7 @@ if sys.version_info >= (2, 6):
@@ -2693,7 +2702,7 @@ if sys.version_info >= (2, 6):
y = memoryview(x)
assert_equal(y.shape, (1,))
assert_equal(y.ndim, 1)
@ -53,7 +53,7 @@ diff -up numpy-1.6.2/numpy/core/tests/test_multiarray.py.test_multiarray numpy-1
sz = sum([dtype(b).itemsize for a, b in dt])
if dtype('l').itemsize == 4:
@@ -2228,10 +2237,10 @@ if sys.version_info >= (2, 6):
@@ -2707,10 +2716,10 @@ if sys.version_info >= (2, 6):
x = np.array(([[1,2],[3,4]],), dtype=[('a', ('i', (2,2)))])
y = memoryview(x)
assert_equal(y.format, 'T{(2,2)i:a:}')

View File

@ -1,30 +1,24 @@
diff -up numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c.fix_PyUnicodeObject numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c
--- numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c.fix_PyUnicodeObject 2012-05-19 09:51:54.000000000 -0400
+++ numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c 2012-08-05 16:07:29.956719007 -0400
@@ -652,6 +652,40 @@ PyArray_Scalar(void *data, PyArray_Descr
--- numpy-1.7.0b1/numpy/core/src/multiarray/scalarapi.c 2012-08-12 21:53:17.000000000 -0600
+++ numpy/numpy/core/src/multiarray/scalarapi.c 2012-08-21 16:34:29.864303392 -0600
@@ -641,6 +641,35 @@ 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;
+ char *buffer;
+ if (swap) {
+ buffer = malloc(itemsize);
+ if (buffer == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ memcpy(buffer, data, itemsize);
+ byte_swap_vector(buffer, itemsize >> 2, 4);
+ } else {
+ buffer = data;
+ }
+ u = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer,
+ itemsize >> 2);
+ if (swap) {
+ free(buffer);
+ }
+ 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;
+ }
@ -42,19 +36,19 @@ diff -up numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c.fix_PyUnicodeObject n
if (type->tp_itemsize != 0) {
/* String type */
obj = type->tp_alloc(type, itemsize);
@@ -688,6 +722,7 @@ PyArray_Scalar(void *data, PyArray_Descr
@@ -672,6 +701,7 @@ PyArray_Scalar(void *data, PyArray_Descr
memcpy(destptr, data, itemsize);
return obj;
}
+#if PY_VERSION_HEX < 0x03030000
else if (type_num == PyArray_UNICODE) {
else if (type_num == NPY_UNICODE) {
/* tp_alloc inherited from Python PyBaseObject_Type */
PyUnicodeObject *uni = (PyUnicodeObject*)obj;
@@ -759,6 +794,7 @@ PyArray_Scalar(void *data, PyArray_Descr
@@ -743,6 +773,7 @@ PyArray_Scalar(void *data, PyArray_Descr
#endif
return obj;
}
+#endif // PY_VERSION_HEX < 0x03030000
+#endif /* PY_VERSION_HEX < 0x03030000 */
else {
PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj;
vobj->base = NULL;

View File

@ -1,37 +0,0 @@
commit 09d2c51fa1d09b17060a8545b925f4dded9dedb1
Author: Ondrej Certik <ondrej.certik@gmail.com>
Date: Fri Aug 3 09:36:46 2012 -0700
Follow the C guidelines
diff --git a/numpy/core/src/multiarray/scalarapi.c b/numpy/core/src/multiarray/scalarapi.c
index 0afdc17..97a5e4b 100644
--- a/numpy/core/src/multiarray/scalarapi.c
+++ b/numpy/core/src/multiarray/scalarapi.c
@@ -645,6 +645,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
if (type_num == NPY_UNICODE) {
PyObject *u, *args;
char *buffer;
+
if (swap) {
buffer = malloc(itemsize);
if (buffer == NULL) {
@@ -653,7 +654,8 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
}
memcpy(buffer, data, itemsize);
byte_swap_vector(buffer, itemsize >> 2, 4);
- } else {
+ }
+ else {
buffer = data;
}
u = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer,
@@ -778,7 +780,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
#endif
return obj;
}
-#endif // PY_VERSION_HEX < 0x03030000
+#endif /* PY_VERSION_HEX < 0x03030000 */
else {
PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj;
vobj->base = NULL;

View File

@ -1,50 +0,0 @@
commit f2ac38f09ff258339ef44572a3abba02019e1f55
Author: Ondrej Certik <ondrej.certik@gmail.com>
Date: Fri Aug 3 10:39:25 2012 -0700
Use PyUnicode_DecodeUTF32()
This function handles the swapping automatically and it returns a unicode
object in one of: UCS1, UCS2 or UCS4 internal Python format.
diff --git a/numpy/core/src/multiarray/scalarapi.c b/numpy/core/src/multiarray/scalarapi.c
index 97a5e4b..d9bc492 100644
--- a/numpy/core/src/multiarray/scalarapi.c
+++ b/numpy/core/src/multiarray/scalarapi.c
@@ -644,25 +644,18 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
#if PY_VERSION_HEX >= 0x03030000
if (type_num == NPY_UNICODE) {
PyObject *u, *args;
- char *buffer;
+ int byteorder;
- if (swap) {
- buffer = malloc(itemsize);
- if (buffer == NULL) {
- PyErr_NoMemory();
- return NULL;
- }
- memcpy(buffer, data, itemsize);
- byte_swap_vector(buffer, itemsize >> 2, 4);
- }
- else {
- buffer = data;
- }
- u = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer,
- itemsize >> 2);
- if (swap) {
- free(buffer);
- }
+#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;
}

View File

@ -5,11 +5,11 @@
%endif
#uncomment next line for a release candidate or a beta
%global relc %{nil}
%global relc b1
Name: numpy
Version: 1.6.2
Release: 5%{?dist}
Version: 1.7.0
Release: 0.1.%{relc}%{?dist}
Epoch: 1
Summary: A fast multidimensional array facility for Python
@ -34,14 +34,6 @@ Patch2: 002-fix_PyUnicodeObject.patch
# "FIX: Make sure the tests produce valid unicode"
# copy of upstream commit 4234b6b13e3ee9da6fc1c24e9e8c442d77587837:
Patch3: 4234b6b13e3ee9da6fc1c24e9e8c442d77587837.patch
#
# "Follow the C guidelines"
# copy of upstream commit 09d2c51fa1d09b17060a8545b925f4dded9dedb1:
Patch4: 09d2c51fa1d09b17060a8545b925f4dded9dedb1.patch
#
# "Use PyUnicode_DecodeUTF32()"
# copy of upstream commit f2ac38f09ff258339ef44572a3abba02019e1f55:
Patch5: f2ac38f09ff258339ef44572a3abba02019e1f55.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -112,8 +104,6 @@ This package includes a version of f2py that works properly with NumPy.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
# Regenerate Cython c sources
# This is needed with numpy-1.6.2.tar.gz with python 3.3 to avoid an exception
@ -292,6 +282,11 @@ rm -rf %{buildroot}
%changelog
* Tue Aug 21 2012 Orion Poplawski <orion@cora.nwra.com> - 1:1.7.0-0.1.b1
- Update to 1.7.0b1
- Rebase python 3.3 patchs to current git master
- Drop patches applied upstream
* Sun Aug 5 2012 David Malcolm <dmalcolm@redhat.com> - 1:1.6.2-5
- rework patches for 3.3 to more directly reflect upstream's commits
- re-enable test suite on python 3

View File

@ -1 +1 @@
95ed6c9dcc94af1fc1642ea2a33c1bba numpy-1.6.2.tar.gz
361da69031556e8f1a99a021162c7040 numpy-1.7.0b1.tar.gz