Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

TST: Add a test for bug gh-2668

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...
commit c95da7d48b2b6ff135b15bb9cd169e7e7bc692ef 1 parent e0dd41c
@mwiebe mwiebe authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 numpy/core/tests/test_regression.py
View
17 numpy/core/tests/test_regression.py
@@ -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()
Please sign in to comment.
Something went wrong with that request. Please try again.