Update to 1.7.0b2

Drop patches applied upstream
This commit is contained in:
Orion Poplawski 2012-09-20 14:02:13 -06:00
parent 0d2d06afa3
commit 2fb1c09bd7
11 changed files with 8 additions and 331 deletions

1
.gitignore vendored
View File

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

View File

@ -1,69 +0,0 @@
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
+if sys.version_info[:2] > (3, 2):
+ # In Python 3.3 the representation of empty shape, strides and suboffsets
+ # is an empty tuple instead of None.
+ # http://docs.python.org/dev/whatsnew/3.3.html#api-changes
+ EMPTY = ()
+else:
+ EMPTY = None
+
+
class TestFlags(TestCase):
def setUp(self):
self.a = arange(10)
@@ -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,))
- assert_equal(y.suboffsets, None)
+ assert_equal(y.suboffsets, EMPTY)
assert_equal(y.itemsize, 4)
def test_export_simple_nd(self):
@@ -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))
- assert_equal(y.suboffsets, None)
+ assert_equal(y.suboffsets, EMPTY)
assert_equal(y.itemsize, 8)
def test_export_discontiguous(self):
@@ -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))
- assert_equal(y.suboffsets, None)
+ assert_equal(y.suboffsets, EMPTY)
assert_equal(y.itemsize, 4)
def test_export_record(self):
@@ -2693,7 +2702,7 @@ if sys.version_info >= (2, 6):
y = memoryview(x)
assert_equal(y.shape, (1,))
assert_equal(y.ndim, 1)
- assert_equal(y.suboffsets, None)
+ assert_equal(y.suboffsets, EMPTY)
sz = sum([dtype(b).itemsize for a, b in dt])
if dtype('l').itemsize == 4:
@@ -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:}')
- assert_equal(y.shape, None)
+ assert_equal(y.shape, EMPTY)
assert_equal(y.ndim, 0)
- assert_equal(y.strides, None)
- assert_equal(y.suboffsets, None)
+ assert_equal(y.strides, EMPTY)
+ assert_equal(y.suboffsets, EMPTY)
assert_equal(y.itemsize, 16)
def test_export_endian(self):

View File

@ -1,69 +0,0 @@
--- 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;
+ 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);
@@ -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 == NPY_UNICODE) {
/* tp_alloc inherited from Python PyBaseObject_Type */
PyUnicodeObject *uni = (PyUnicodeObject*)obj;
@@ -743,6 +773,7 @@ PyArray_Scalar(void *data, PyArray_Descr
#endif
return obj;
}
+#endif /* PY_VERSION_HEX < 0x03030000 */
else {
PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj;
vobj->base = NULL;
diff -up numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src.fix_PyUnicodeObject numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src
--- numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src.fix_PyUnicodeObject 2012-05-19 09:51:54.000000000 -0400
+++ numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src 2012-08-05 16:05:40.868718999 -0400
@@ -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 */

View File

@ -1,28 +0,0 @@
commit 4234b6b13e3ee9da6fc1c24e9e8c442d77587837
Author: Ondrej Certik <ondrej.certik@gmail.com>
Date: Fri Aug 3 07:27:42 2012 -0700
FIX: Make sure the tests produce valid unicode
The tests are testing byte order for unicode, so we can only use such unicode
data, so that both versions (swapped and unswapped) are valid unicode.
diff --git a/numpy/core/tests/test_unicode.py b/numpy/core/tests/test_unicode.py
index d47ac54..7b27076 100644
--- a/numpy/core/tests/test_unicode.py
+++ b/numpy/core/tests/test_unicode.py
@@ -26,10 +26,12 @@ else:
return len(arr.data)
return len(buffer(arr))
+# In both cases below we need to make sure that the byte swapped value (as
+# UCS4) is still a valid unicode:
# Value that can be represented in UCS2 interpreters
-ucs2_value = u'\uFFFF'
+ucs2_value = u'\u0900'
# Value that cannot be represented in UCS2 interpreters (but can in UCS4)
-ucs4_value = u'\U0010FFFF'
+ucs4_value = u'\U00100900'
############################################################

View File

@ -1,27 +0,0 @@
--- numpy-1.0.1/numpy/f2py/f2py.1.f2pynumpy 2007-01-03 23:07:33.000000000 -0500
+++ numpy-1.0.1/numpy/f2py/f2py.1 2007-01-03 23:10:00.000000000 -0500
@@ -180,11 +180,7 @@
.SH REQUIREMENTS
Python 1.5.2 or higher (2.x is supported).
-Numerical Python 13 or higher (20.x,21.x,22.x,23.x are supported).
-
-Optional Numarray 0.9 or higher partially supported.
-
-numpy_distutils from Scipy (can be downloaded from F2PY homepage)
+numpy_distutils from Numpy
.SH "SEE ALSO"
python(1)
.SH BUGS
@@ -200,10 +196,8 @@
Mailing list: http://cens.ioc.ee/mailman/listinfo/f2py-users/
-Scipy website: http://www.numpy.org
+Numpy website: http://numeric.scipy.org/
.SH COPYRIGHT
Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Pearu Peterson
.SH LICENSE
NumPy License
-.SH VERSION
-2.45.241

View File

@ -1,27 +0,0 @@
diff -up numpy-1.4.1/numpy/core/src/multiarray/numpyos.c.remove-PyOS_ascii_strtod numpy-1.4.1/numpy/core/src/multiarray/numpyos.c
--- numpy-1.4.1/numpy/core/src/multiarray/numpyos.c.remove-PyOS_ascii_strtod 2010-07-22 19:15:18.846696632 -0400
+++ numpy-1.4.1/numpy/core/src/multiarray/numpyos.c 2010-07-22 19:16:24.454744969 -0400
@@ -506,7 +506,11 @@ NumPyOS_ascii_strtod(const char *s, char
}
memcpy(buffer, s, n);
buffer[n] = '\0';
+#if PY_VERSION_HEX >= 0x02070000
+ result = PyOS_string_to_double(buffer, &q, NULL);
+#else
result = PyOS_ascii_strtod(buffer, &q);
+#endif
if (endptr != NULL) {
*endptr = (char*)(s + (q - buffer));
}
@@ -515,7 +519,11 @@ NumPyOS_ascii_strtod(const char *s, char
}
/* End of ##2 */
+#if PY_VERSION_HEX >= 0x02070000
+ return PyOS_string_to_double(s, endptr, NULL);
+#else
return PyOS_ascii_strtod(s, endptr);
+#endif
}

View File

@ -1,40 +0,0 @@
--- numpy-1.3.0/numpy/core/include/numpy/npy_cpu.h
+++ numpy-1.3.0/numpy/core/include/numpy/npy_cpu.h 2009-04-05 10:09:20.000000000 +0200
@@ -9,6 +9,7 @@
* NPY_CPU_S390
* NPY_CPU_IA64
* NPY_CPU_PARISC
+ * NPY_CPU_ARM
*/
#ifndef _NPY_CPUARCH_H_
#define _NPY_CPUARCH_H_
@@ -45,6 +46,12 @@
#elif defined(__parisc__)
/* XXX: Not sure about this one... */
#define NPY_CPU_PARISC
+#elif defined(__ARM__) || defined(__arm__)
+# if defined(__ARMEB__)
+ #define NPY_CPU_ARMEB
+# else
+ #define NPY_CPU_ARMEL
+# endif
#else
#error Unknown CPU, please report this to numpy maintainers with \
information about your platform (OS, CPU and compiler)
---numpy-1.3.0/numpy/core/include/numpy/npy_endian.h
+++ numpy-1.3.0.backup/numpy/core/include/numpy/npy_endian.h 2009-04-05 10:09:20.000000000 +0200
@@ -22,11 +22,12 @@
#include "npy_cpu.h"
#if defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64)\
- || defined(NPY_CPU_IA64)
+ || defined(NPY_CPU_IA64) || defined(NPY_CPU_ARMEL)
#define NPY_LITTLE_ENDIAN
#define NPY_BYTE_ORDER 1234
#elif defined(NPY_CPU_PPC) || defined(NPY_CPU_SPARC)\
- || defined(NPY_CPU_S390) || defined(NPY_CPU_PARISC)
+ || defined(NPY_CPU_S390) || defined(NPY_CPU_PARISC)\
+ || defined(NPY_CPU_ARMEB)
#define NPY_BIG_ENDIAN
#define NPY_BYTE_ORDER 4321
#else

View File

@ -1,33 +0,0 @@
diff -up numpy-1.7.0b1/numpy/core/src/multiarray/methods.c.pull371 numpy-1.7.0b1/numpy/core/src/multiarray/methods.c
--- numpy-1.7.0b1/numpy/core/src/multiarray/methods.c.pull371 2012-08-12 21:53:17.000000000 -0600
+++ numpy-1.7.0b1/numpy/core/src/multiarray/methods.c 2012-08-22 22:07:17.287365026 -0600
@@ -1587,8 +1587,9 @@ array_setstate(PyArrayObject *self, PyOb
/* Check that the string is not interned */
if (!_IsAligned(self) || swap || PyString_CHECK_INTERNED(rawdata)) {
#else
- /* Bytes are never interned */
- if (!_IsAligned(self) || swap) {
+ /* Bytes should always be considered immutable, but we just grab the
+ * pointer if they are large, to save memory. */
+ if (!_IsAligned(self) || swap || (len <= 1000)) {
#endif
npy_intp num = PyArray_NBYTES(self);
fa->data = PyDataMem_NEW(num);
diff -up numpy-1.7.0b1/numpy/core/tests/test_regression.py.pull371 numpy-1.7.0b1/numpy/core/tests/test_regression.py
--- numpy-1.7.0b1/numpy/core/tests/test_regression.py.pull371 2012-08-12 21:53:17.000000000 -0600
+++ numpy-1.7.0b1/numpy/core/tests/test_regression.py 2012-08-21 16:34:29.894303390 -0600
@@ -1601,6 +1601,14 @@ class TestRegression(TestCase):
s = re.sub("a(.)", "\x01\\1", "a_")
assert_equal(s[0], "\x01")
+ def test_pickle_bytes_overwrite(self):
+ if sys.version_info[0] >= 3:
+ data = np.array([1], dtype='b')
+ data = pickle.loads(pickle.dumps(data))
+ data[0] = 0xdd
+ bytestring = "\x01 ".encode('ascii')
+ assert_equal(bytestring[0:1], '\x01'.encode('ascii'))
+
def test_structured_type_to_object(self):
a_rec = np.array([(0,1), (3,2)], dtype='i4,i8')
a_obj = np.empty((2,), dtype=object)

View File

@ -5,11 +5,11 @@
%endif
#uncomment next line for a release candidate or a beta
%global relc b1
%global relc b2
Name: numpy
Version: 1.7.0
Release: 0.3.%{relc}%{?dist}
Release: 0.4.%{relc}%{?dist}
Epoch: 1
Summary: A fast multidimensional array facility for Python
@ -18,27 +18,6 @@ License: BSD
URL: http://numeric.scipy.org/
Source0: http://downloads.sourceforge.net/numpy/%{name}-%{version}%{?relc}.tar.gz
# Fix tests for empty shape, strides and suboffsets on Python 3.3
# Backported from 02f3d1f73ca5957d3b5a3e575293e4d970de4267 upstream, see
# https://github.com/numpy/numpy/pull/367
Patch1: 001-fix-test_multiarray.patch
# Patches to fix PyUnicodeObject handling under 3.3, taken from upstream
# See
# https://github.com/numpy/numpy/pull/372
#
# "FIX: Fixes the PyUnicodeObject problem in py-3.3"
# based on upstream commit a9d58ab42da8d2ed9071044848a54c5e066b557a:
Patch2: 002-fix_PyUnicodeObject.patch
#
# "FIX: Make sure the tests produce valid unicode"
# copy of upstream commit 4234b6b13e3ee9da6fc1c24e9e8c442d77587837:
Patch3: 4234b6b13e3ee9da6fc1c24e9e8c442d77587837.patch
#
# Copy bytes object when unpickling an array
# https://github.com/numpy/numpy/pull/371
Patch4: numpy-pull371.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python2-devel lapack-devel python-setuptools gcc-gfortran atlas-devel python-nose
@ -105,10 +84,6 @@ This package includes a version of f2py that works properly with NumPy.
%prep
%setup -q -n %{name}-%{version}%{?relc}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1 -b .pull371
# workaround for rhbz#849713
# http://mail.scipy.org/pipermail/numpy-discussion/2012-July/063530.html
@ -278,6 +253,10 @@ rm -rf %{buildroot}
%changelog
* Thu Sep 20 2012 Orion Poplawski <orion@nwra.com> - 1:1.7.0-0.4.b2
- Update to 1.7.0b2
- Drop patches applied upstream
* Wed Aug 22 2012 Orion Poplawski <orion@nwra.com> - 1:1.7.0-0.3.b1
- Add patch from github pull 371 to fix python 3.3 pickle issue
- Remove cython .c source regeneration - fails now

View File

@ -1,10 +0,0 @@
Index: numpy/core/src/multiarray/number.c
===================================================================
--- numpy/core/src/multiarray/number.c (revision 7888)
+++ numpy/core/src/multiarray/number.c (revision 8364)
@@ -31,4 +31,5 @@
return -1; \
} \
+ Py_INCREF(temp); \
Py_XDECREF(n_ops.op); \
n_ops.op = temp; \

View File

@ -1 +1 @@
361da69031556e8f1a99a021162c7040 numpy-1.7.0b1.tar.gz
1b62cf0e34e2db58b0241b00d603df24 numpy-1.7.0b2.tar.gz