summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBruce Merry <bmerry@ska.ac.za>2019-06-05 11:18:52 +0200
committerBruce Merry <bmerry@ska.ac.za>2019-06-05 11:18:52 +0200
commitd0fa4cab40732f59a74c786ded5fcda6c76421fd (patch)
tree44dc667c99c9a2f8f8c7e7ea2dce99c32531820f /numpy
parent5a967c9d61f7c2ecce4e215065731a7ab2832574 (diff)
downloadnumpy-d0fa4cab40732f59a74c786ded5fcda6c76421fd.tar.gz
TST: add a regression test for #13715
Without the fix, this test will still pass, but will show up as a use-after-free when run under valgrind.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_indexing.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py
index 99792cee7..f7485c3f7 100644
--- a/numpy/core/tests/test_indexing.py
+++ b/numpy/core/tests/test_indexing.py
@@ -249,6 +249,15 @@ class TestIndexing(object):
[4, 0, 6],
[0, 8, 0]])
+ def test_boolean_indexing_list(self):
+ # Regression test for #13715. It's a use-after-free bug which the
+ # test won't directly catch, but it will show up in valgrind.
+ a = np.array([1, 2, 3])
+ b = [True, False, True]
+ # Two variants of the test because the first takes a fast path
+ assert_equal(a[b], [1, 3])
+ assert_equal(a[None, b], [[1, 3]])
+
def test_reverse_strides_and_subspace_bufferinit(self):
# This tests that the strides are not reversed for simple and
# subspace fancy indexing.