Hello community, here is the log from the commit of package python3-numpy for openSUSE:Factory checked in at 2014-08-13 08:49:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-numpy (Old) and /work/SRC/openSUSE:Factory/.python3-numpy.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-numpy" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-numpy/python3-numpy-doc.changes 2014-04-17 14:08:53.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-numpy.new/python3-numpy-doc.changes 2014-08-13 08:49:12.000000000 +0200 @@ -1,0 +2,19 @@ +Mon Aug 11 10:09:38 UTC 2014 - [email protected] + +- Update to 1.8.2: Bugfix release + * gh-4836: partition produces wrong results for multiple selections in equal ranges + * gh-4656: Make fftpack._raw_fft threadsafe + * gh-4628: incorrect argument order to _copyto in in np.nanmax, np.nanmin + * gh-4642: Hold GIL for converting dtypes types with fields + * gh-4733: fix np.linalg.svd(b, compute_uv=False) + * gh-4853: avoid unaligned simd load on reductions on i386 + * gh-4722: Fix seg fault converting empty string to object + * gh-4613: Fix lack of NULL check in array_richcompare + * gh-4774: avoid unaligned access for strided byteswap + * gh-650: Prevent division by zero when creating arrays from some buffers + * gh-4602: ifort has issues with optimization flag O2, use O1 +- Switch to pypi download location +- Changed Url to current home page +- Minor spec file cleanups + +------------------------------------------------------------------- python3-numpy.changes: same change Old: ---- numpy-1.8.1.tar.gz New: ---- numpy-1.8.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-numpy-doc.spec ++++++ --- /var/tmp/diff_new_pack.o1N5De/_old 2014-08-13 08:49:13.000000000 +0200 +++ /var/tmp/diff_new_pack.o1N5De/_new 2014-08-13 08:49:13.000000000 +0200 @@ -17,13 +17,13 @@ Name: python3-numpy-doc -Version: 1.8.1 +Version: 1.8.2 Release: 0 -Url: http://sourceforge.net/projects/numpy +Url: http://www.numpy.org/ Summary: Documentation for python3-numpy License: BSD-3-Clause Group: Development/Libraries/Python -Source: numpy-%{version}.tar.gz +Source: https://pypi.python.org/packages/source/n/numpy/numpy-%{version}.tar.gz Patch0: numpy-buildfix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} == 1220 ++++++ python3-numpy.spec ++++++ --- /var/tmp/diff_new_pack.o1N5De/_old 2014-08-13 08:49:13.000000000 +0200 +++ /var/tmp/diff_new_pack.o1N5De/_new 2014-08-13 08:49:13.000000000 +0200 @@ -19,13 +19,13 @@ %define with_atlas 0 Name: python3-numpy -Version: 1.8.1 +Version: 1.8.2 Release: 0 -Url: http://sourceforge.net/projects/numpy +Url: http://www.numpy.org/ Summary: NumPy array processing for numbers, strings, records and objects License: BSD-3-Clause Group: Development/Libraries/Python -Source: http://sourceforge.net/projects/numpy/files/NumPy/%{version}/numpy-%{version}.tar.gz +Source: https://pypi.python.org/packages/source/n/numpy/numpy-%{version}.tar.gz Patch0: numpy-buildfix.patch Patch1: numpy-double-double-le.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -33,9 +33,9 @@ BuildRequires: lapack-devel BuildRequires: python3 >= 3.2 BuildRequires: python3-devel >= 3.2 -# Cython needed for mtrand.c regenerating (python3.3) BuildRequires: fdupes BuildRequires: gcc-fortran +# Cython needed for mtrand.c regenerating (python3.3) BuildRequires: python3-Cython %if %{with_atlas} == 1 BuildRequires: libatlas3-devel @@ -90,7 +90,7 @@ %doc *.txt %{_bindir}/f2py3 %{python3_sitearch}/numpy/ -%{python3_sitearch}/numpy-%{version}-py%{py3_ver}.egg-info +%{python3_sitearch}/numpy-%{version}-py*.egg-info %exclude %{python3_sitearch}/numpy/*/*/*.c %exclude %{python3_sitearch}/numpy/*/*.h %exclude %{python3_sitearch}/numpy/*/*/*.h ++++++ numpy-1.8.1.tar.gz -> numpy-1.8.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/PKG-INFO new/numpy-1.8.2/PKG-INFO --- old/numpy-1.8.1/PKG-INFO 2014-03-25 22:44:56.000000000 +0100 +++ new/numpy-1.8.2/PKG-INFO 2014-08-09 14:19:46.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: numpy -Version: 1.8.1 +Version: 1.8.2 Summary: NumPy: array processing for numbers, strings, records, and objects. Home-page: http://www.numpy.org Author: NumPy Developers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/doc/release/1.8.2-notes.rst new/numpy-1.8.2/doc/release/1.8.2-notes.rst --- old/numpy-1.8.1/doc/release/1.8.2-notes.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/numpy-1.8.2/doc/release/1.8.2-notes.rst 2014-08-09 12:41:26.000000000 +0200 @@ -0,0 +1,19 @@ +NumPy 1.8.2 Release Notes +************************* + +This is a bugfix only release in the 1.8.x series. + +Issues fixed +============ + +* gh-4836: partition produces wrong results for multiple selections in equal ranges +* gh-4656: Make fftpack._raw_fft threadsafe +* gh-4628: incorrect argument order to _copyto in in np.nanmax, np.nanmin +* gh-4642: Hold GIL for converting dtypes types with fields +* gh-4733: fix np.linalg.svd(b, compute_uv=False) +* gh-4853: avoid unaligned simd load on reductions on i386 +* gh-4722: Fix seg fault converting empty string to object +* gh-4613: Fix lack of NULL check in array_richcompare +* gh-4774: avoid unaligned access for strided byteswap +* gh-650: Prevent division by zero when creating arrays from some buffers +* gh-4602: ifort has issues with optimization flag O2, use O1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/doc/source/release.rst new/numpy-1.8.2/doc/source/release.rst --- old/numpy-1.8.1/doc/source/release.rst 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/doc/source/release.rst 2014-08-05 20:23:08.000000000 +0200 @@ -2,6 +2,7 @@ Release Notes ************* +.. include:: ../release/1.8.2-notes.rst .. include:: ../release/1.8.1-notes.rst .. include:: ../release/1.8.0-notes.rst .. include:: ../release/1.7.2-notes.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/src/multiarray/arrayobject.c new/numpy-1.8.2/numpy/core/src/multiarray/arrayobject.c --- old/numpy-1.8.1/numpy/core/src/multiarray/arrayobject.c 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/src/multiarray/arrayobject.c 2014-08-05 20:04:19.000000000 +0200 @@ -1404,7 +1404,11 @@ return result; } array_other = (PyArrayObject *)PyArray_FromObject(other, - NPY_NOTYPE, 0, 0); + NPY_NOTYPE, 0, 0); + if (array_other == NULL) { + PyErr_Clear(); + return result; + } if (PyArray_ISSTRING(self) && PyArray_ISSTRING(array_other)) { Py_DECREF(result); result = _strings_richcompare(self, (PyArrayObject *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/src/multiarray/arraytypes.c.src new/numpy-1.8.2/numpy/core/src/multiarray/arraytypes.c.src --- old/numpy-1.8.1/numpy/core/src/multiarray/arraytypes.c.src 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/src/multiarray/arraytypes.c.src 2014-08-09 12:41:26.000000000 +0200 @@ -394,7 +394,7 @@ int size = PyArray_DESCR(ap)->elsize; ptr = ip + size - 1; - while (*ptr-- == '\0' && size > 0) { + while (size > 0 && *ptr-- == '\0') { size--; } return PyBytes_FromStringAndSize(ip,size); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/src/multiarray/ctors.c new/numpy-1.8.2/numpy/core/src/multiarray/ctors.c --- old/numpy-1.8.1/numpy/core/src/multiarray/ctors.c 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/src/multiarray/ctors.c 2014-08-05 20:04:19.000000000 +0200 @@ -311,7 +311,7 @@ case 1: /* no byteswap necessary */ break; case 4: - if (npy_is_aligned(p, sizeof(npy_uint32))) { + if (npy_is_aligned((void*)((npy_intp)p | stride), sizeof(npy_uint32))) { for (a = (char*)p; n > 0; n--, a += stride) { npy_uint32 * a_ = (npy_uint32 *)a; *a_ = npy_bswap4(*a_); @@ -324,7 +324,7 @@ } break; case 8: - if (npy_is_aligned(p, sizeof(npy_uint64))) { + if (npy_is_aligned((void*)((npy_intp)p | stride), sizeof(npy_uint64))) { for (a = (char*)p; n > 0; n--, a += stride) { npy_uint64 * a_ = (npy_uint64 *)a; *a_ = npy_bswap8(*a_); @@ -337,7 +337,7 @@ } break; case 2: - if (npy_is_aligned(p, sizeof(npy_uint16))) { + if (npy_is_aligned((void*)((npy_intp)p | stride), sizeof(npy_uint16))) { for (a = (char*)p; n > 0; n--, a += stride) { npy_uint16 * a_ = (npy_uint16 *)a; *a_ = npy_bswap2(*a_); @@ -1279,7 +1279,9 @@ else { d = view->len; for (k = 0; k < nd; ++k) { - d /= view->shape[k]; + if (view->shape[k] != 0) { + d /= view->shape[k]; + } strides[k] = d; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/src/multiarray/descriptor.c new/numpy-1.8.2/numpy/core/src/multiarray/descriptor.c --- old/numpy-1.8.1/numpy/core/src/multiarray/descriptor.c 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/src/multiarray/descriptor.c 2014-08-05 20:04:19.000000000 +0200 @@ -366,7 +366,8 @@ PyObject *nameslist; PyArray_Descr *new; PyArray_Descr *conv; - char dtypeflags = 0; + /* Types with fields need the Python C API for field access */ + char dtypeflags = NPY_NEEDS_PYAPI; int maxalign = 0; n = PyList_GET_SIZE(obj); @@ -555,7 +556,8 @@ PyObject *nameslist = NULL; int ret; int maxalign = 0; - char dtypeflags = 0; + /* Types with fields need the Python C API for field access */ + char dtypeflags = NPY_NEEDS_PYAPI; n = PyList_GET_SIZE(obj); /* @@ -890,7 +892,8 @@ int n, i; int totalsize, itemsize; int maxalign = 0; - char dtypeflags = 0; + /* Types with fields need the Python C API for field access */ + char dtypeflags = NPY_NEEDS_PYAPI; int has_out_of_order_fields = 0; fields = PyDict_New(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/src/npysort/selection.c.src new/numpy-1.8.2/numpy/core/src/npysort/selection.c.src --- old/numpy-1.8.1/numpy/core/src/npysort/selection.c.src 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/src/npysort/selection.c.src 2014-08-05 20:04:19.000000000 +0200 @@ -379,7 +379,10 @@ /* move pivot into position */ SWAP(SORTEE(low), SORTEE(hh)); - store_pivot(hh, kth, pivots, npiv); + /* kth pivot stored later */ + if (hh != kth) { + store_pivot(hh, kth, pivots, npiv); + } if (hh >= kth) high = hh - 1; @@ -389,10 +392,11 @@ /* two elements */ if (high == low + 1) { - if (@TYPE@_LT(v[IDX(high)], v[IDX(low)])) + if (@TYPE@_LT(v[IDX(high)], v[IDX(low)])) { SWAP(SORTEE(high), SORTEE(low)) - store_pivot(low, kth, pivots, npiv); + } } + store_pivot(kth, kth, pivots, npiv); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/src/umath/simd.inc.src new/numpy-1.8.2/numpy/core/src/umath/simd.inc.src --- old/numpy-1.8.1/numpy/core/src/umath/simd.inc.src 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/src/umath/simd.inc.src 2014-08-05 20:04:19.000000000 +0200 @@ -39,7 +39,9 @@ ((abs(args[1] - args[0]) >= (vsize)) || ((abs(args[1] - args[0]) == 0)))) #define IS_BLOCKABLE_REDUCE(esize, vsize) \ - (steps[1] == (esize) && abs(args[1] - args[0]) >= (vsize)) + (steps[1] == (esize) && abs(args[1] - args[0]) >= (vsize) && \ + npy_is_aligned(args[1], (esize)) && \ + npy_is_aligned(args[0], (esize))) #define IS_BLOCKABLE_BINARY(esize, vsize) \ (steps[0] == steps[1] && steps[1] == steps[2] && steps[2] == (esize) && \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/tests/test_dtype.py new/numpy-1.8.2/numpy/core/tests/test_dtype.py --- old/numpy-1.8.1/numpy/core/tests/test_dtype.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/tests/test_dtype.py 2014-08-09 12:41:26.000000000 +0200 @@ -449,6 +449,10 @@ # Issue gh-2798 a = np.array(['a'], dtype="O").astype(("O", [("name", "O")])) + def test_empty_string_to_object(self): + # Pull request #4722 + np.array(["", ""]).astype(object) + class TestDtypeAttributeDeletion(object): def test_dtype_non_writable_attributes_deletion(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/tests/test_multiarray.py new/numpy-1.8.2/numpy/core/tests/test_multiarray.py --- old/numpy-1.8.1/numpy/core/tests/test_multiarray.py 2014-03-25 22:43:36.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/tests/test_multiarray.py 2014-08-05 20:04:19.000000000 +0200 @@ -1143,6 +1143,12 @@ d[i:].partition(0, kind=k) assert_array_equal(d, tgt) + d = np.array([0, 1, 2, 3, 4, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 9]) + kth = [0, 3, 19, 20] + assert_equal(np.partition(d, kth, kind=k)[kth], (0, 3, 7, 7)) + assert_equal(d[np.argpartition(d, kth, kind=k)][kth], (0, 3, 7, 7)) + d = np.array([2, 1]) d.partition(0, kind=k) assert_raises(ValueError, d.partition, 2) @@ -1332,6 +1338,18 @@ assert_equal(np.partition(d, k)[k], tgt[k]) assert_equal(d[np.argpartition(d, k)][k], tgt[k]) + def test_partition_fuzz(self): + # a few rounds of random data testing + for j in range(10, 30): + for i in range(1, j - 2): + d = np.arange(j) + np.random.shuffle(d) + d = d % np.random.randint(2, 30) + idx = np.random.randint(d.size) + kth = [0, idx, i, i + 1] + tgt = np.sort(d)[kth] + assert_array_equal(np.partition(d, kth)[kth], tgt, + err_msg="data: %r\n kth: %r" % (d, kth)) def test_flatten(self): x0 = np.array([[1, 2, 3], [4, 5, 6]], np.int32) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/tests/test_regression.py new/numpy-1.8.2/numpy/core/tests/test_regression.py --- old/numpy-1.8.1/numpy/core/tests/test_regression.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/tests/test_regression.py 2014-08-05 20:04:19.000000000 +0200 @@ -1945,6 +1945,26 @@ formatted = '{0}'.format(arr[0]) assert_equal(formatted, str(arr[0])) + def test_richcompare_crash(self): + # gh-4613 + import operator as op + + # dummy class where __array__ throws exception + class Foo(object): + __array_priority__ = 1002 + def __array__(self,*args,**kwargs): + raise Exception() + + rhs = Foo() + lhs = np.array(1) + for f in [op.lt, op.le, op.gt, op.ge]: + if sys.version_info[0] >= 3: + assert_raises(TypeError, f, lhs, rhs) + else: + f(lhs, rhs) + assert_(not op.eq(lhs, rhs)) + assert_(op.ne(lhs, rhs)) + if __name__ == "__main__": run_module_suite() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/tests/test_scalarmath.py new/numpy-1.8.2/numpy/core/tests/test_scalarmath.py --- old/numpy-1.8.1/numpy/core/tests/test_scalarmath.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/tests/test_scalarmath.py 2014-08-05 20:04:19.000000000 +0200 @@ -75,6 +75,18 @@ np.add(1, inp2, out=out) assert_almost_equal(out, exp1, err_msg=msg) + def test_lower_align(self): + # check data that is not aligned to element size + # i.e doubles are aligned to 4 bytes on i386 + d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) + o = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) + assert_almost_equal(d + d, d * 2) + np.add(d, d, out=o) + np.add(np.ones_like(d), d, out=o) + np.add(d, np.ones_like(d), out=o) + np.add(np.ones_like(d), d) + np.add(d, np.ones_like(d)) + class TestPower(TestCase): def test_small_types(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/core/tests/test_umath.py new/numpy-1.8.2/numpy/core/tests/test_umath.py --- old/numpy-1.8.1/numpy/core/tests/test_umath.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/core/tests/test_umath.py 2014-08-05 20:04:19.000000000 +0200 @@ -711,6 +711,12 @@ inp[i] = -1e10 assert_equal(inp.min(), -1e10, err_msg=msg) + def test_lower_align(self): + # check data that is not aligned to element size + # i.e doubles are aligned to 4 bytes on i386 + d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) + assert_equal(d.max(), d[0]) + assert_equal(d.min(), d[0]) class TestAbsolute(TestCase): @@ -736,6 +742,21 @@ np.abs(inp, out=out) assert_array_equal(out, d, err_msg=msg) + assert_array_equal(-inp, -1*inp, err_msg=msg) + np.negative(inp, out=out) + assert_array_equal(out, -1*inp, err_msg=msg) + + def test_lower_align(self): + # check data that is not aligned to element size + # i.e doubles are aligned to 4 bytes on i386 + d = np.zeros(23 * 8, dtype=np.int8)[4:-4].view(np.float64) + assert_equal(np.abs(d), d) + assert_equal(np.negative(d), -d) + np.negative(d, out=d) + np.negative(np.ones_like(d), out=d) + np.abs(d, out=d) + np.abs(np.ones_like(d), out=d) + class TestSpecialMethods(TestCase): def test_wrap(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/distutils/fcompiler/intel.py new/numpy-1.8.2/numpy/distutils/fcompiler/intel.py --- old/numpy-1.8.1/numpy/distutils/fcompiler/intel.py 2014-03-25 20:43:23.000000000 +0100 +++ new/numpy-1.8.2/numpy/distutils/fcompiler/intel.py 2014-08-05 20:04:19.000000000 +0200 @@ -162,7 +162,7 @@ return ['/4Yb', '/d2'] def get_flags_opt(self): - return ['/O2'] + return ['/O1'] # Scipy test failures with /O2 def get_flags_arch(self): return ["/arch:IA-32", "/QaxSSE3"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/fft/fftpack.py new/numpy-1.8.2/numpy/fft/fftpack.py --- old/numpy-1.8.1/numpy/fft/fftpack.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/fft/fftpack.py 2014-08-05 20:04:19.000000000 +0200 @@ -53,10 +53,12 @@ raise ValueError("Invalid number of FFT data points (%d) specified." % n) try: - wsave = fft_cache[n] - except(KeyError): + # Thread-safety note: We rely on list.pop() here to atomically + # retrieve-and-remove a wsave from the cache. This ensures that no + # other thread can get the same wsave while we're using it. + wsave = fft_cache.setdefault(n, []).pop() + except (IndexError): wsave = init_function(n) - fft_cache[n] = wsave if a.shape[axis] != n: s = list(a.shape) @@ -77,6 +79,12 @@ r = work_function(a, wsave) if axis != -1: r = swapaxes(r, axis, -1) + + # As soon as we put wsave back into the cache, another thread could pick it + # up and start using it, so we must not do this until after we're + # completely done using it ourselves. + fft_cache[n].append(wsave) + return r diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/fft/tests/test_fftpack.py new/numpy-1.8.2/numpy/fft/tests/test_fftpack.py --- old/numpy-1.8.1/numpy/fft/tests/test_fftpack.py 2014-03-25 20:43:23.000000000 +0100 +++ new/numpy-1.8.2/numpy/fft/tests/test_fftpack.py 2014-08-05 20:04:18.000000000 +0200 @@ -2,6 +2,14 @@ import numpy as np from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal +from numpy.testing import assert_array_equal +import threading +import sys +if sys.version_info[0] >= 3: + import queue +else: + import Queue as queue + def fft1(x): L = len(x) @@ -9,6 +17,7 @@ phase = np.arange(L).reshape(-1, 1) * phase return np.sum(x*np.exp(phase), axis=1) + class TestFFTShift(TestCase): def test_fft_n(self): @@ -23,5 +32,44 @@ assert_array_almost_equal(fft1(x), np.fft.fft(x)) +class TestFFTThreadSafe(TestCase): + threads = 16 + input_shape = (800, 200) + + def _test_mtsame(self, func, *args): + def worker(args, q): + q.put(func(*args)) + + q = queue.Queue() + expected = func(*args) + + # Spin off a bunch of threads to call the same function simultaneously + t = [threading.Thread(target=worker, args=(args, q)) + for i in range(self.threads)] + [x.start() for x in t] + + # Make sure all threads returned the correct value + for i in range(self.threads): + assert_array_equal(q.get(timeout=5), expected, + 'Function returned wrong value in multithreaded context') + [x.join() for x in t] + + def test_fft(self): + a = np.ones(self.input_shape) * 1+0j + self._test_mtsame(np.fft.fft, a) + + def test_ifft(self): + a = np.ones(self.input_shape) * 1+0j + self._test_mtsame(np.fft.ifft, a) + + def test_rfft(self): + a = np.ones(self.input_shape) + self._test_mtsame(np.fft.rfft, a) + + def test_irfft(self): + a = np.ones(self.input_shape) * 1+0j + self._test_mtsame(np.fft.irfft, a) + + if __name__ == "__main__": run_module_suite() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/lib/nanfunctions.py new/numpy-1.8.2/numpy/lib/nanfunctions.py --- old/numpy-1.8.1/numpy/lib/nanfunctions.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/lib/nanfunctions.py 2014-08-05 20:04:19.000000000 +0200 @@ -228,7 +228,7 @@ # Check for all-NaN axis mask = np.all(mask, axis=axis, keepdims=keepdims) if np.any(mask): - res = _copyto(res, mask, np.nan) + res = _copyto(res, np.nan, mask) warnings.warn("All-NaN axis encountered", RuntimeWarning) return res @@ -327,7 +327,7 @@ # Check for all-NaN axis mask = np.all(mask, axis=axis, keepdims=keepdims) if np.any(mask): - res = _copyto(res, mask, np.nan) + res = _copyto(res, np.nan, mask) warnings.warn("All-NaN axis encountered", RuntimeWarning) return res diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/lib/tests/test_nanfunctions.py new/numpy-1.8.2/numpy/lib/tests/test_nanfunctions.py --- old/numpy-1.8.1/numpy/lib/tests/test_nanfunctions.py 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/lib/tests/test_nanfunctions.py 2014-08-05 20:04:19.000000000 +0200 @@ -114,6 +114,31 @@ assert_(res.shape == (3, 1)) res = f(mat) assert_(np.isscalar(res)) + # check that rows of nan are dealt with for subclasses (#4628) + mat[1] = np.nan + for f in self.nanfuncs: + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + res = f(mat, axis=0) + assert_(isinstance(res, np.matrix)) + assert_(not np.any(np.isnan(res))) + assert_(len(w) == 0) + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + res = f(mat, axis=1) + assert_(isinstance(res, np.matrix)) + assert_(np.isnan(res[1, 0]) and not np.isnan(res[0, 0]) + and not np.isnan(res[2, 0])) + assert_(len(w) == 1, 'no warning raised') + assert_(issubclass(w[0].category, RuntimeWarning)) + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + res = f(mat) + assert_(np.isscalar(res)) + assert_(res != np.nan) + assert_(len(w) == 0) class TestNanFunctions_ArgminArgmax(TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/linalg/tests/test_regression.py new/numpy-1.8.2/numpy/linalg/tests/test_regression.py --- old/numpy-1.8.1/numpy/linalg/tests/test_regression.py 2014-03-25 20:43:23.000000000 +0100 +++ new/numpy-1.8.2/numpy/linalg/tests/test_regression.py 2014-08-05 20:04:19.000000000 +0200 @@ -73,7 +73,15 @@ # See gh-4442, 64bit would require very large/slow matrices. x = np.eye(1000, 66) np.linalg.svd(x) - + + def test_svd_no_uv(self): + # gh-4733 + for shape in (3, 4), (4, 4), (4, 3): + for t in float, complex: + a = np.ones(shape, dtype=t) + w = linalg.svd(a, compute_uv=False) + c = np.count_nonzero(np.absolute(w) > 0.5) + assert_equal(c, 1) if __name__ == '__main__': run_module_suite() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/linalg/umath_linalg.c.src new/numpy-1.8.2/numpy/linalg/umath_linalg.c.src --- old/numpy-1.8.1/numpy/linalg/umath_linalg.c.src 2014-03-25 20:43:24.000000000 +0100 +++ new/numpy-1.8.2/numpy/linalg/umath_linalg.c.src 2014-08-05 20:04:19.000000000 +0200 @@ -3073,7 +3073,7 @@ "svd when n>=m. ", 4, 1, 1, FUNC_ARRAY_NAME(svd_N), - equal_2_types + svd_1_1_types }, { "svd_n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/numpy/version.py new/numpy-1.8.2/numpy/version.py --- old/numpy-1.8.1/numpy/version.py 2014-03-25 22:44:55.000000000 +0100 +++ new/numpy-1.8.2/numpy/version.py 2014-08-09 14:19:45.000000000 +0200 @@ -1,9 +1,9 @@ # THIS FILE IS GENERATED FROM NUMPY SETUP.PY -short_version = '1.8.1' -version = '1.8.1' -full_version = '1.8.1' -git_revision = '62a7575fd82ddf028517780c01fecf7e0cca27aa' +short_version = '1.8.2' +version = '1.8.2' +full_version = '1.8.2' +git_revision = '4563730a2d036307f1b67b2856d749aabdd8d546' release = True if not release: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpy-1.8.1/setup.py new/numpy-1.8.2/setup.py --- old/numpy-1.8.1/setup.py 2014-03-25 22:43:36.000000000 +0100 +++ new/numpy-1.8.2/setup.py 2014-08-09 12:41:42.000000000 +0200 @@ -49,7 +49,7 @@ MAJOR = 1 MINOR = 8 -MICRO = 1 +MICRO = 2 ISRELEASED = True VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
