summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-06-14 12:38:21 -0400
committerCharles Harris <charlesr.harris@gmail.com>2015-06-14 12:38:21 -0400
commit31d05f2f83384fb05111d71ccbf98ef23f22737b (patch)
treee3c1de7d55c50a747062735fc0f094c5583574ed /numpy
parent899a2a2abafe565be634c134c76395753b906834 (diff)
parent7721d3d10e85d4ddbc22d600bb99567cd4d6ecad (diff)
downloadnumpy-31d05f2f83384fb05111d71ccbf98ef23f22737b.tar.gz
Merge pull request #5965 from charris/add-test-from-gh-5960
TST: Add test for segfault in richcompare of void type ==, !=.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_ufunc.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index f40342350..58bf74539 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -1166,6 +1166,19 @@ class TestUfunc(TestCase):
assert_raises(TypeError, f, d, axis=0, dtype=None,
out=None, invalid=0)
+ def test_structured_equal(self):
+ # https://github.com/numpy/numpy/issues/4855
+ class MyA(np.ndarray):
+ def __numpy_ufunc__(self, ufunc, method, i, inputs, **kwargs):
+ return getattr(ufunc, method)(*(input.view(np.ndarray)
+ for input in inputs), **kwargs)
+ a = np.arange(12.).reshape(4,3)
+ ra = a.view(dtype=('f8,f8,f8')).squeeze()
+ mra = ra.view(MyA)
+
+ target = np.array([ True, False, False, False], dtype=bool)
+ assert_equal(np.all(target == (mra == ra[0])), True)
+
def test_NotImplemented_not_returned(self):
# See gh-5964 and gh-2091. Some of these functions are not operator
# related and were fixed for other reasons in the past.