--- /dev/null
+
+Contributors
+============
+
+A total of 4 people contributed to this release. People with a "+" by their
+names contributed a patch for the first time.
+
+* Charles Harris
+* Eric Wieser
+* Julian Taylor
+* Matti Picus
+
+Pull requests merged
+====================
+
+A total of 4 pull requests were merged for this release.
+
+* `#11985 <https://github.com/numpy/numpy/pull/11985>`__: BUG: fix cached allocations without the GIL
+* `#11986 <https://github.com/numpy/numpy/pull/11986>`__: BUG: Undo behavior change in ma.masked_values(shrink=True)
+* `#11987 <https://github.com/numpy/numpy/pull/11987>`__: BUG: fix refcount leak in PyArray_AdaptFlexibleDType
+* `#11995 <https://github.com/numpy/numpy/pull/11995>`__: TST: Add Python 3.7 testing to NumPy 1.14.
--- /dev/null
+
+Contributors
+============
+
+A total of 4 people contributed to this release. People with a "+" by their
+names contributed a patch for the first time.
+
+* Charles Harris
+* Julian Taylor
+* Marten van Kerkwijk
+* Matti Picus
+
+Pull requests merged
+====================
+
+A total of 4 pull requests were merged for this release.
+
+* `#11902 <https://github.com/numpy/numpy/pull/11902>`__: BUG: Fix matrix PendingDeprecationWarning suppression for pytest...
+* `#11981 <https://github.com/numpy/numpy/pull/11981>`__: BUG: fix cached allocations without the GIL for 1.15.x
+* `#11982 <https://github.com/numpy/numpy/pull/11982>`__: BUG: fix refcount leak in PyArray_AdaptFlexibleDType
+* `#11992 <https://github.com/numpy/numpy/pull/11992>`__: BUG: Ensure boolean indexing of subclasses sets base correctly.
--- /dev/null
+==========================
+NumPy 1.14.6 Release Notes
+==========================
+
+This is a bugfix release for bugs reported following the 1.14.5 release. The
+most significant fixes are:
+
+* Fix for behavior change in ``ma.masked_values(shrink=True)``
+* Fix the new cached allocations machinery to be thread safe.
+
+The Python versions supported in this release are 2.7 and 3.4 - 3.7. The Python
+3.6 wheels on PyPI should be compatible with all Python 3.6 versions.
+
+Contributors
+============
+
+A total of 4 people contributed to this release. People with a "+" by their
+names contributed a patch for the first time.
+
+* Charles Harris
+* Eric Wieser
+* Julian Taylor
+* Matti Picus
+
+Pull requests merged
+====================
+
+A total of 4 pull requests were merged for this release.
+
+* `#11985 <https://github.com/numpy/numpy/pull/11985>`__: BUG: fix cached allocations without the GIL
+* `#11986 <https://github.com/numpy/numpy/pull/11986>`__: BUG: Undo behavior change in ma.masked_values(shrink=True)
+* `#11987 <https://github.com/numpy/numpy/pull/11987>`__: BUG: fix refcount leak in PyArray_AdaptFlexibleDType
+* `#11995 <https://github.com/numpy/numpy/pull/11995>`__: TST: Add Python 3.7 testing to NumPy 1.14.
--- /dev/null
+==========================
+NumPy 1.15.2 Release Notes
+==========================
+
+This is a bugfix release for bugs and regressions reported following the 1.15.1
+release.
+
+* The matrix PendingDeprecationWarning is now suppressed in pytest 3.8.
+* The new cached allocations machinery has been fixed to be thread safe.
+* The boolean indexing of subclasses now works correctly.
+* A small memory leak in PyArray_AdaptFlexibleDType has been fixed.
+
+The Python versions supported by this release are 2.7, 3.4-3.7. The wheels are
+linked with OpenBLAS v0.3.0, which should fix some of the linalg problems
+reported for NumPy 1.14.
+
+Compatibility Note
+==================
+
+The NumPy 1.15.x OS X wheels released on PyPI no longer contain 32-bit
+binaries. That will also be the case in future releases. See
+`#11625 <https://github.com/numpy/numpy/issues/11625>`__ for the related
+discussion. Those needing 32-bit support should look elsewhere or build
+from source.
+
+Contributors
+============
+
+A total of 4 people contributed to this release. People with a "+" by their
+names contributed a patch for the first time.
+
+* Charles Harris
+* Julian Taylor
+* Marten van Kerkwijk
+* Matti Picus
+
+Pull requests merged
+====================
+
+A total of 4 pull requests were merged for this release.
+
+* `#11902 <https://github.com/numpy/numpy/pull/11902>`__: BUG: Fix matrix PendingDeprecationWarning suppression for pytest...
+* `#11981 <https://github.com/numpy/numpy/pull/11981>`__: BUG: fix cached allocations without the GIL for 1.15.x
+* `#11982 <https://github.com/numpy/numpy/pull/11982>`__: BUG: fix refcount leak in PyArray_AdaptFlexibleDType
+* `#11992 <https://github.com/numpy/numpy/pull/11992>`__: BUG: Ensure boolean indexing of subclasses sets base correctly.
Release Notes
*************
+.. include:: ../release/1.15.2-notes.rst
.. include:: ../release/1.15.1-notes.rst
.. include:: ../release/1.15.0-notes.rst
+.. include:: ../release/1.14.6-notes.rst
.. include:: ../release/1.14.5-notes.rst
.. include:: ../release/1.14.4-notes.rst
.. include:: ../release/1.14.3-notes.rst
static cache_bucket datacache[NBUCKETS];
static cache_bucket dimcache[NBUCKETS_DIM];
+/* as the cache is managed in global variables verify the GIL is held */
+#if defined(NPY_PY3K)
+#define NPY_CHECK_GIL_HELD() PyGILState_Check()
+#else
+#define NPY_CHECK_GIL_HELD() 1
+#endif
+
/*
* very simplistic small memory block cache to avoid more expensive libc
* allocations
{
assert((esz == 1 && cache == datacache) ||
(esz == sizeof(npy_intp) && cache == dimcache));
+ assert(NPY_CHECK_GIL_HELD());
if (nelem < msz) {
if (cache[nelem].available > 0) {
return cache[nelem].ptrs[--(cache[nelem].available)];
_npy_free_cache(void * p, npy_uintp nelem, npy_uint msz,
cache_bucket * cache, void (*dealloc)(void *))
{
+ assert(NPY_CHECK_GIL_HELD());
if (p != NULL && nelem < msz) {
if (cache[nelem].available < NCACHE) {
cache[nelem].ptrs[cache[nelem].available++] = p;
{
PyArray_DatetimeMetaData *meta;
int flex_type_num;
- PyArrayObject *arr = NULL;
- PyArray_Descr *dtype = NULL;
- int ndim = 0;
- npy_intp dims[NPY_MAXDIMS];
- int result;
if (*flex_dtype == NULL) {
if (!PyErr_Occurred()) {
/* Flexible types with expandable size */
if (PyDataType_ISUNSIZED(*flex_dtype)) {
- /* First replace the flex dtype */
+ /* First replace the flex_dtype */
PyArray_DESCR_REPLACE(*flex_dtype);
if (*flex_dtype == NULL) {
return;
* GetArrayParamsFromObject won't iterate over
* array.
*/
+ PyArray_Descr *dtype = NULL;
+ PyArrayObject *arr = NULL;
+ int result;
+ int ndim = 0;
+ npy_intp dims[NPY_MAXDIMS];
list = PyArray_ToList((PyArrayObject *)data_obj);
result = PyArray_GetArrayParamsFromObject(
list,
size = dtype->elsize;
}
}
+ Py_XDECREF(dtype);
+ Py_XDECREF(arr);
Py_DECREF(list);
}
else if (PyArray_IsPythonScalar(data_obj)) {
}
size = it->size;
- NPY_BEGIN_THREADS_DESCR(PyArray_DESCR(op));
-
if (needcopy) {
buffer = npy_alloc_cache(N * elsize);
if (buffer == NULL) {
}
}
+ NPY_BEGIN_THREADS_DESCR(PyArray_DESCR(op));
+
while (size--) {
char *bufptr = it->dataptr;
}
fail:
- npy_free_cache(buffer, N * elsize);
NPY_END_THREADS_DESCR(PyArray_DESCR(op));
+ npy_free_cache(buffer, N * elsize);
if (ret < 0 && !PyErr_Occurred()) {
/* Out of memory during sorting or buffer creation */
PyErr_NoMemory();
}
size = it->size;
- NPY_BEGIN_THREADS_DESCR(PyArray_DESCR(op));
-
if (needcopy) {
valbuffer = npy_alloc_cache(N * elsize);
if (valbuffer == NULL) {
}
}
+ NPY_BEGIN_THREADS_DESCR(PyArray_DESCR(op));
+
while (size--) {
char *valptr = it->dataptr;
npy_intp *idxptr = (npy_intp *)rit->dataptr;
}
fail:
+ NPY_END_THREADS_DESCR(PyArray_DESCR(op));
npy_free_cache(valbuffer, N * elsize);
npy_free_cache(idxbuffer, N * sizeof(npy_intp));
- NPY_END_THREADS_DESCR(PyArray_DESCR(op));
if (ret < 0) {
if (!PyErr_Occurred()) {
/* Out of memory during sorting or buffer creation */
char *valbuffer, *indbuffer;
int *swaps;
- valbuffer = npy_alloc_cache(N * maxelsize);
+ valbuffer = PyDataMem_NEW(N * maxelsize);
if (valbuffer == NULL) {
goto fail;
}
- indbuffer = npy_alloc_cache(N * sizeof(npy_intp));
+ indbuffer = PyDataMem_NEW(N * sizeof(npy_intp));
if (indbuffer == NULL) {
- npy_free_cache(indbuffer, N * sizeof(npy_intp));
+ PyDataMem_FREE(indbuffer);
goto fail;
}
swaps = malloc(n*sizeof(int));
sizeof(npy_intp), N, sizeof(npy_intp));
PyArray_ITER_NEXT(rit);
}
- npy_free_cache(valbuffer, N * maxelsize);
- npy_free_cache(indbuffer, N * sizeof(npy_intp));
+ PyDataMem_FREE(valbuffer);
+ PyDataMem_FREE(indbuffer);
free(swaps);
}
else {
ret = (PyArrayObject *)PyArray_NewFromDescrAndBase(
Py_TYPE(self), dtype,
1, &size, PyArray_STRIDES(ret), PyArray_BYTES(ret),
- PyArray_FLAGS(self), (PyObject *)self, (PyObject *)self);
+ PyArray_FLAGS(self), (PyObject *)self, (PyObject *)tmp);
if (ret == NULL) {
Py_DECREF(tmp);
class TestSubclasses(object):
def test_basic(self):
+ # Test that indexing in various ways produces SubClass instances,
+ # and that the base is set up correctly: the original subclass
+ # instance for views, and a new ndarray for advanced/boolean indexing
+ # where a copy was made (latter a regression test for gh-11983).
class SubClass(np.ndarray):
pass
- s = np.arange(5).view(SubClass)
- assert_(isinstance(s[:3], SubClass))
- assert_(s[:3].base is s)
-
- assert_(isinstance(s[[0, 1, 2]], SubClass))
- assert_(isinstance(s[s > 0], SubClass))
+ a = np.arange(5)
+ s = a.view(SubClass)
+ s_slice = s[:3]
+ assert_(type(s_slice) is SubClass)
+ assert_(s_slice.base is s)
+ assert_array_equal(s_slice, a[:3])
+
+ s_fancy = s[[0, 1, 2]]
+ assert_(type(s_fancy) is SubClass)
+ assert_(s_fancy.base is not s)
+ assert_(type(s_fancy.base) is np.ndarray)
+ assert_array_equal(s_fancy, a[[0, 1, 2]])
+ assert_array_equal(s_fancy.base, a[[0, 1, 2]])
+
+ s_bool = s[s > 0]
+ assert_(type(s_bool) is SubClass)
+ assert_(s_bool.base is not s)
+ assert_(type(s_bool.base) is np.ndarray)
+ assert_array_equal(s_bool, a[a > 0])
+ assert_array_equal(s_bool.base, a[a > 0])
def test_finalize_gets_full_info(self):
# Array finalize should be called on the filled array.
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
+import pytest
try:
# Accessing collections abstract classes from collections
def test_matrix_memory_sharing(self):
assert_(np.may_share_memory(self.m, self.m.ravel()))
assert_(not np.may_share_memory(self.m, self.m.flatten()))
+
+ def test_expand_dims_matrix(self):
+ # matrices are always 2d - so expand_dims only makes sense when the
+ # type is changed away from matrix.
+ a = np.arange(10).reshape((2, 5)).view(np.matrix)
+ expanded = np.expand_dims(a, axis=1)
+ assert_equal(expanded.ndim, 3)
+ assert_(not isinstance(expanded, np.matrix))
"""
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
+import pytest
import textwrap
import warnings
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
-
import pickle
+import pytest
import numpy as np
from numpy.ma.testutils import (assert_, assert_equal, assert_raises,
""" Test functions for linalg module using the matrix class."""
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
+import pytest
import numpy as np
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
+import pytest
import numpy as np
from numpy.testing import assert_, assert_equal, assert_array_equal
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
+import pytest
import numpy as np
from numpy.testing import assert_equal
from __future__ import division, absolute_import, print_function
-# As we are testing matrices, we ignore its PendingDeprecationWarnings
-try:
- import pytest
- pytestmark = pytest.mark.filterwarnings(
- 'ignore:the matrix subclass is not:PendingDeprecationWarning')
-except ImportError:
- pass
+import pytest
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises
boiler plate for doing that is to put the following in the module
``__init__.py`` file::
- from numpy.testing import PytestTester
+ from numpy._pytesttester import PytestTester
test = PytestTester(__name__).test
del PytestTester
In practice, tests run from the numpy repo are run in develop mode. That
includes the standard ``python runtests.py`` invocation.
+This module is imported by every numpy subpackage, so lies at the top level to
+simplify circular import issues. For the same reason, it contains no numpy
+imports at module scope, instead importing numpy within function calls.
"""
from __future__ import division, absolute_import, print_function
"-W ignore::UserWarning:cpuinfo",
]
+ # When testing matrices, ignore their PendingDeprecationWarnings
+ pytest_args += [
+ "-W ignore:the matrix subclass is not",
+ ]
+
+ # Ignore python2.7 -3 warnings
+ pytest_args += [
+ r"-W ignore:sys\.exc_clear\(\) not supported in 3\.x:DeprecationWarning",
+ r"-W ignore:in 3\.x, __setslice__:DeprecationWarning",
+ r"-W ignore:in 3\.x, __getslice__:DeprecationWarning",
+ r"-W ignore:buffer\(\) not supported in 3\.x:DeprecationWarning",
+ r"-W ignore:CObject type is not supported in 3\.x:DeprecationWarning",
+ r"-W ignore:comparing unequal types not supported in 3\.x:DeprecationWarning",
+ r"-W ignore:the commands module has been removed in Python 3\.0:DeprecationWarning",
+ r"-W ignore:The 'new' module has been removed in Python 3\.0:DeprecationWarning",
+ ]
+
+
if doctests:
raise ValueError("Doctests not supported")
#-----------------------------------
# Source of the release notes
-RELEASE_NOTES = 'doc/release/1.15.1-notes.rst'
+RELEASE_NOTES = 'doc/release/1.15.2-notes.rst'
# Start/end of the log (from git)
-LOG_START = 'v1.15.0'
+LOG_START = 'v1.15.1'
LOG_END = 'maintenance/1.15.x'
ignore:Not importing directory
ignore:numpy.dtype size changed
ignore:numpy.ufunc size changed
+ ignore::UserWarning:cpuinfo,
+# Matrix PendingDeprecationWarning.
+ ignore:the matrix subclass is not
# Ignore python2.7 -3 warnings
ignore:sys\.exc_clear\(\) not supported in 3\.x:DeprecationWarning
ignore:in 3\.x, __setslice__:DeprecationWarning
ignore:CObject type is not supported in 3\.x:DeprecationWarning
ignore:comparing unequal types not supported in 3\.x:DeprecationWarning
ignore:the commands module has been removed in Python 3\.0:DeprecationWarning
+ ignore:The 'new' module has been removed in Python 3\.0:DeprecationWarning
+
env =
PYTHONHASHSEED=0
MAJOR = 1
MINOR = 15
-MICRO = 1
+MICRO = 2
ISRELEASED = True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)