Skip to content

Commit

Permalink
TST: Add a test for bug gh-2668
Browse files Browse the repository at this point in the history
This is the test attached to the bug from Matthew Brett.
I tried to make a simpler test, but it didn't repro
the problem.
  • Loading branch information
mwiebe committed Dec 11, 2012
1 parent e0dd41c commit c95da7d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions numpy/core/tests/test_regression.py
Expand Up @@ -1812,5 +1812,22 @@ def test_searchsorted_wrong_dtype(self):
a = np.recarray((2, ), dtype)
assert_raises(TypeError, np.searchsorted, a, 1)

def test_complex64_alignment(self):
# Issue gh-2668 (trac 2076), segfault on sparc due to misalignment
dtt = np.complex64
arr = np.arange(10, dtype=dtt)
# 2D array
arr2 = np.reshape(arr, (2, 5))
# Fortran write followed by (C or F) read caused bus error
data_str = arr2.tostring('F')
data_back = np.ndarray(arr2.shape,
arr2.dtype,
buffer=data_str,
order='F')
assert_array_equal(arr2, data_back)




if __name__ == "__main__":
run_module_suite()

0 comments on commit c95da7d

Please sign in to comment.